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

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

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

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

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>

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.