Very easy one...About Buttons..

Discussion in 'Javascript' started by John, Feb 24, 2004.

  1. John

    John Guest

    I am a VB programmer and know nothing about Javascript. I have a Java
    Button in my asp page (It came with Visual Studio 6) and I want it to
    open a page called DBSearch.asp. I also want it to take with it a
    variable in the Input (Text Box) I have above the button (Looks like
    the Google search page) - I have no clue... Any help much appreciated.
    Example code would be the best...

    After I dragged it onto my ASP page I created the following


    function button1_onclick() {


    }

    But I do not know what syntax I need inside...

    Regards
    John
     
    John, Feb 24, 2004
    #1
    1. Advertising

  2. John

    Ivo Guest

    "John" <> wrote in message
    news:...
    > I am a VB programmer and know nothing about Javascript. I have a Java
    > Button in my asp page (It came with Visual Studio 6) and I want it to
    > open a page called DBSearch.asp. I also want it to take with it a
    > variable in the Input (Text Box) I have above the button (Looks like
    > the Google search page) - I have no clue... Any help much appreciated.


    What is a Java Button? It sounds like you just want to submit a form, no
    javascript required.
    <form action="DBSearch.asp" method="get">
    <input type="text" value="" name="TextBoxName">
    <input type="submit">
    </form>
    Now if anyone clicks submit, DBSearch.asp will be loaded with the string
    "?TextBoxName=" attached to the URL. If they entered something into that
    textbox before submitting, that text will be attached too. I don't see where
    javascript would be needed.
    If you insist and favor unreliable javascript over forms, something like
    this would do thesame thing:
    <input type="text" value="" id="TextBoxName">
    <input type="button" value="Submit" onclick="location.href =
    'DBSearch.asp?TextBoxName=' +
    escape(document.getElementById('TextBoxName').value) ;">

    The onclick string is on one line. It would require the browser
    understanding getElementById,
    HTH
    Ivo
     
    Ivo, Feb 24, 2004
    #2
    1. Advertising

  3. John

    John Guest

    Thanks Ivo, but this is still confusing. I dragged the button from the
    HTML Toolbox. Now I want to code the button. The code says that it is
    a Javascript button, I would much prefer VBScript myself but it seems
    only to give me a Javascript option.

    Also the code example you gave, where would I put it in my asp page -
    yes, sorry, I am that much of a beginner... The code below is what I
    got when I put in the button, how do I tell it to do what I mentioned
    before.


    <P align=center><INPUT type=button value=Search id=button1
    name=button1 LANGUAGE=javascript onclick="return
    button1_onclick()"><INPUT style="WIDTH: 62px; HEIGHT: 24px"
    type=button size=25 value=Clear></P></TD>

    Thanks for your help..
    John





    "Ivo" <> wrote in message news:<403afe36$0$54702$>...
    > "John" <> wrote in message
    > news:...
    > > I am a VB programmer and know nothing about Javascript. I have a Java
    > > Button in my asp page (It came with Visual Studio 6) and I want it to
    > > open a page called DBSearch.asp. I also want it to take with it a
    > > variable in the Input (Text Box) I have above the button (Looks like
    > > the Google search page) - I have no clue... Any help much appreciated.

    >
    > What is a Java Button? It sounds like you just want to submit a form, no
    > javascript required.
    > <form action="DBSearch.asp" method="get">
    > <input type="text" value="" name="TextBoxName">
    > <input type="submit">
    > </form>
    > Now if anyone clicks submit, DBSearch.asp will be loaded with the string
    > "?TextBoxName=" attached to the URL. If they entered something into that
    > textbox before submitting, that text will be attached too. I don't see where
    > javascript would be needed.
    > If you insist and favor unreliable javascript over forms, something like
    > this would do thesame thing:
    > <input type="text" value="" id="TextBoxName">
    > <input type="button" value="Submit" onclick="location.href =
    > 'DBSearch.asp?TextBoxName=' +
    > escape(document.getElementById('TextBoxName').value) ;">
    >
    > The onclick string is on one line. It would require the browser
    > understanding getElementById,
    > HTH
    > Ivo
     
    John, Feb 25, 2004
    #3
  4. John

    Ivo Guest

    "John" <> wrote in message
    news:...
    > Thanks Ivo, but this is still confusing. I dragged the button from the
    > HTML Toolbox. Now I want to code the button. The code says that it is
    > a Javascript button, I would much prefer VBScript myself but it seems
    > only to give me a Javascript option.
    >
    > Also the code example you gave, where would I put it in my asp page -
    > yes, sorry, I am that much of a beginner... The code below is what I
    > got when I put in the button, how do I tell it to do what I mentioned
    > before.
    >
    > <P align=center><INPUT type=button value=Search id=button1
    > name=button1 LANGUAGE=javascript onclick="return
    > button1_onclick()"><INPUT style="WIDTH: 62px; HEIGHT: 24px"
    > type=button size=25 value=Clear></P></TD>


    First time I see a language attribute with an input element... Also I don't
    see the other textbox value that you would like to take to the next page.
    Really, all this button needs to do, collect data and forward to a new page
    with this data, can be done with an ordinary HTML form. It 's exactly what
    they were invented for back in HTML 0.1. Try it with the 4 lines of form
    code below, put it in the place where you found the above Input tags and
    tell us what 's not working if something isn't working.
    Cheers,
    Ivo
    >
    > > <form action="DBSearch.asp" method="get">
    > > <input type="text" value="" name="TextBoxName">
    > > <input type="submit">
    > > </form>
     
    Ivo, Feb 25, 2004
    #4
  5. John

    John Guest

    Thanks Ivo, you are completely correct, I was getting way too
    complicated for my own good - its works great, thanks a ton.

    Regards
    John

    "Ivo" <> wrote in message news:<403c591e$0$63142$>...
    > "John" <> wrote in message
    > news:...
    > > Thanks Ivo, but this is still confusing. I dragged the button from the
    > > HTML Toolbox. Now I want to code the button. The code says that it is
    > > a Javascript button, I would much prefer VBScript myself but it seems
    > > only to give me a Javascript option.
    > >
    > > Also the code example you gave, where would I put it in my asp page -
    > > yes, sorry, I am that much of a beginner... The code below is what I
    > > got when I put in the button, how do I tell it to do what I mentioned
    > > before.
    > >
    > > <P align=center><INPUT type=button value=Search id=button1
    > > name=button1 LANGUAGE=javascript onclick="return
    > > button1_onclick()"><INPUT style="WIDTH: 62px; HEIGHT: 24px"
    > > type=button size=25 value=Clear></P></TD>

    >
    > First time I see a language attribute with an input element... Also I don't
    > see the other textbox value that you would like to take to the next page.
    > Really, all this button needs to do, collect data and forward to a new page
    > with this data, can be done with an ordinary HTML form. It 's exactly what
    > they were invented for back in HTML 0.1. Try it with the 4 lines of form
    > code below, put it in the place where you found the above Input tags and
    > tell us what 's not working if something isn't working.
    > Cheers,
    > Ivo
    > >
    > > > <form action="DBSearch.asp" method="get">
    > > > <input type="text" value="" name="TextBoxName">
    > > > <input type="submit">
    > > > </form>
     
    John, Feb 26, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Hoge

    Very, very, easy question

    John Hoge, May 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    379
  2. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    483
    Raymond Hettinger
    Jul 27, 2003
  3. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,629
    Merrill & Michele
    Oct 19, 2004
  4. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    427
    jacob navia
    Oct 17, 2004
  5. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    518
    Dave Thompson
    Feb 14, 2005
Loading...

Share This Page