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

Q748 Is it possible to create a select form field menu which redirects to other pages without any "go" button?

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

Q748 Is it possible to create a select form field menu which redirects to other pages without any "go" button?

Yes:

<SCRIPT LANGUAGE="JavaScript"><!--
function goto_URL(object) {
    window.location.href = object.options[object.selectedIndex].value;
}
//--></SCRIPT>

<FORM>
<SELECT NAME="selectName" onChange="goto_URL(this.form.selectName)">
<OPTION VALUE="http://www.irt.org">irt.org
<OPTION VALUE="http://www.irt.org/script/faq.htm">JavaScript FAQ
</SELECT>
</FORM>

On some older browsers the onChange event handler does not trigger until the focus moves from the form field.


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.