Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1319 How do I have a dropdown menu selection automatically load a page without hitting a submit button?

You are here: irt.org | FAQ | JavaScript | Form | Q1319 [ previous next ]

Most of the information is in the article Dropdown Menus

I personally prefer this:

<form>
<select name="theSelect" size=1 onChange="if (this.selectedIndex >0) window.location=this.options[this.selectedIndex].value">
<option value="">Please select a place to go
<option value="http://irt.org/">irt
<option value="http://www.microsoft.com/">MS
<option value="http://www.netscape.com/">NS
</select>
</form>

If you are going to handle 16 bit browsers you might want to add this:

<input type="button" value="go" onClick="if (this.for.theSelect.selectedIndex >0) window.location=this.form.theSelect.options[this.form.theSelect.selectedIndex].value">

©2018 Martin Webb