Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

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;

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

©2018 Martin Webb