Entry
How can I make a drop down select list of URL's that jumps automatically?
How can I make a select list that automatically redirects to a different page?
Jan 26th, 2006 06:33
Maro M, Ben Udall, Nathan Wallace,
The HTML you want to generate will look something like:
<select name="blah"
onchange="window.location=this.options[selectedIndex].value";>
<option value="#">-- Please select and entry --</option>
<option value="http://blah1.com">Go to blah1</option>
<option value="http://blah2.com">Go to blah2</option>
<option value="http://blah3.com">Go to blah3</option>
</select>
This is a neat trick, however, it's generally regarded as a bad idea
for a couple reasons.
First, it makes it impossible to use the keyboard to select an option.
This may not be that big of an issue for people who can use a mouse,
however, the blind have no choice.
Second, your site becomes dependent on JavaScript. People with browsers
that don't support javascript or have it disabled can't navigate your
site. A website should _never_ require javascript to work for this
reason.
Note that it is important to add the first 'dummy' option, otherwise,
the user will not be able to select the first entry.