Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  28] [ 6]  / answers: 1 / hits: 91091  / 12 Years ago, mon, april 16, 2012, 12:00:00

I am trying to make a drop down menu that takes me to various webpages. Right now it is set up so you make your selection and then you hit a Go button and then it takes you to the appropriate link. I am trying to figure out how to make it so when you make your selection it automatically goes and you don't need to push the Go button.



Here is what I have:



<p align=center>
<form name=jump class=center>
<select name=menu>
<option value=#>Select an option</option>
<option value=/link1.shtml>Link 1</option>
<option value=/link2.shtml>Link 2</option>
<option value=/link3.shtml>Link 3</option>
</select>
<input type=button onClick=location=document.jump.menu.options[document.jump.menu.selectedIndex].value; value=GO>
</form>
</p>


Any help or links to explanations would be great. Thank you!


More From » html

 Answers
86

Try the following:



<select onchange=location = this.options[this.selectedIndex].value;>
<option>Please select</option>
<option value=http://www.apple.com/>Apple</option>
<option value=http://www.bbc.com>BBC</option>
<option value=http://www.facebook.com>Facebook</option>
</select>​


What you were looking for was 'onchange' instead of 'onsubmit'


[#86214] Saturday, April 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ciarajourneyv

Total Points: 428
Total Questions: 95
Total Answers: 90

Location: Maldives
Member since Sat, Feb 11, 2023
1 Year ago
;