Page 1 of 1

<select>

Posted: Wed Dec 22, 2004 10:08 am
by sutejok
can someone give me the syntax for <select> which automaticly go to some page when it is selected?

Posted: Wed Dec 22, 2004 10:13 am
by pickle
Well, just put an "onChange" handler on the select box. In that handler, put a javascript function that gets the value of that select box, then forwards the user on to a particular page dependant on that value.

Posted: Wed Dec 22, 2004 10:16 am
by sutejok
hmm. may i know the syntax for the javascript?

Posted: Wed Dec 22, 2004 10:19 am
by pickle
People always learn best by doing :). Essentially, you want to pass to that function "this", which is a reference to the select box that calls it. Then, you want to get the value selected ([whatever you call the variable in the function].value), and check it - a bunch of if/else statements should work. Then, change the location of the page. I think document.location = newpage.html should work for that.

Posted: Fri Jan 21, 2005 7:02 pm
by qads
there are loads of scripts/tutorials out there on the net, search for javascript jump box in google.