|
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.