View Full Version : jumping to object (webpage) from select ?

11-05-2010, 04:26 PM

I am trying to utilize the 2 level select menu found here in this tutorial: http://www.javascriptkit.com/javatutors/selectcontent2.shtml , except when the object is selected a message pops up on the screen -- and instead I need it to actually take users to an existing website/webpage.

How would this get changed to do that??? or is there another 2 level select menu that has that already coded that someone could point me to...


11-06-2010, 10:34 AM
Change the option value to the corresponding url.

cities[1]=["New York|http://www.google.com/", "Los Angeles|http://www.yahoo.com", ...

Then remove the onclick on the cities dropdown and change it to onchange

<select name="cities" size="4" style="width: 150px" onchange="if (this.value) location.href=this.value;">

If you want it to open in a new window instead of the same window:

<select name="cities" size="4" style="width: 150px" onchange="if (this.value) window.open(this.value, '_blank');">

11-06-2010, 02:40 PM
Tks Glenn.