Very easy one...About Buttons..

J

John

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
 
I

Ivo

John said:
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
 
J

John

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
 
I

Ivo

John said:
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
 
J

John

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

Regards
John
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top