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

Q701 How do I target differrent frames based on a URL value selected from a drop down list?

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

It depends what the criteria is for choosing the frames based on the url. Detecting absolute vs. relative URLs is easy:

<SCRIPT LANGUAGE="JavaScript"><!--
function go(what) {
    value = what.options[what.selectedIndex].value;
    if (value == '') return;
    if (value.indexOf('http://') == 0)
        parent.frames[0].location.href = value;
    else
        parent.frames[1].location.href = value;
}
//--></SCRIPT>

<FORM>
<SELECT onChange="go(this)">
<OPTION VALUE="">Select one:
<OPTION VALUE="http://www.irt.org/index.htm">irt.org
<OPTION VALUE="index.htm">Index
</SELECT>
</FORM>

©2018 Martin Webb