Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Form | Q1319 [ previous next ]

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

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">

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.