|
-
Dec 3rd, 2001, 04:31 PM
#1
Thread Starter
Frenzied Member
javascript form
this shouldn't be too hard, but I want to have a textbox, and a button and when someone clicks that button, i want it to goto /files/(number in textbox).htm
how can I do this
thanks,
Dimava
NXSupport - Your one-stop source for computer help
-
Dec 3rd, 2001, 04:36 PM
#2
Frenzied Member
Check to see if window.navigate() is part of the standards. If so, you can build the URL (myURL = "http://www.mydomain.com/mysite/files/" + document.myForm.myTextInput.Value + ".html";) and pass it on. Might want to validate the input first.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Dec 3rd, 2001, 05:06 PM
#3
Thread Starter
Frenzied Member
I have this:
Code:
<input type="text" name="textfield2" size="5" maxlength="3">
<input type="submit" name="Download2" value="Download">
what do I do next? (i dont have a form)
thanks
Dimava
NXSupport - Your one-stop source for computer help
-
Dec 3rd, 2001, 05:18 PM
#4
Frenzied Member
Out of practice, I always put input elements in a form. But, I guess you don't have to. It just gets a little stickier when you want to reffer to the input element by ID.
Some key words to look up regarding HTML/DOM/JavaScript.
document.getElementByID()
the onClick attribute
window.navigate()
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Dec 3rd, 2001, 05:35 PM
#5
Thread Starter
Frenzied Member
I coudln't really find anything that would help me out
NXSupport - Your one-stop source for computer help
-
Dec 4th, 2001, 02:37 AM
#6
PowerPoster
hi
First of all - enclose all elements like buttons,textboxes,textarea be enclosed in forms - otherwise I think it will not work in NetScape.
Code:
<script language="javascript">
function CallPage(theform)
{
mstr = "/files/" + theform.textfield2.value + ".htm";
window.location.href = mstr;
}
</script>
<form name=myform>
<input type="text" name="textfield2" size="5" maxlength="3">
<input type="button" name="Download2" value="Download" onclick="CallPage(document.myform);">
</form>
Thats it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|