HomeArticlesFAQsXREFGamesSoftwareInstantBooksBBSAboutFOLDOCRFCsFeedbackSearchSite-Map
logo

Q523 How can different selections in an options field open in different frames and windows?

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

Because there are only two variable in a drop down list, the text description, and the url value, dictating which window or frame to be targeted has to be done outside of the drop down menu and in the function:

<script language="JavaScript"><!--
function go(what) {
    var whereto = what.options[what.selectedIndex].value;
    if (whereto == "http://www.irt.org/")
        top.location.href = whereto;
    else if (whereto == "http://www.ibm.com")
        parent.otherframename.location.href = whereto;
}
//--></script>

<form>
<select onChange="go(this)">
<option value="http://www.irt.org/">Internet Related Technologies
<option value="http://www.ibm.com">IBM
</select>
</form>

©2011 Martin Webb