We've all seen sites that feature drop down lists that automatically take you to your selection without you needing to make the cumbersome and lengthy step of hitting a "Go" button. If you've ever wondered how they do this then as you probably expected it's very simple.
What on Earth am I talking about?
Picture a drop down list as follows:
We often see a button next to the list that the user should press in order to actually activate there selection:
How do we do it?
A typical dropdown list is instantiated using the following:
(Give or take some attributes). What we do is add an attribute that instructs the page to call our handler for when the list selection is changed.
<select name=select1 onchange='OnChange(this.form.select1);'>
Our handler will look up the value that has just been selected, and navigate to an appropriate URL. An example of this is shown below:
var myindex = dropdown.selectedIndex
var SelValue = dropdown.options[myindex].value
var baseURL = <Some value based on SelValue>
top.location.href = baseURL;
We use the
</select><noscript><INPUT type="submit" value="Go" name=submit1></noscript>