How would I create a dropdown menu that opens links in another window (e.g. "view_frame")?
Here's a sample script that opens the link to the same window (parent):
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="#" selected>Archives</option>
<option value="link.html">link</option></select>
</form>
Staffer Stone changed it to this:
function MM_jumpMenu(selObj,restore){ //v3.0
var url = selObj.options[selObj.selectedIndex].value;
if (url) window.open(url);
if (restore) selObj.selectedIndex=0;
}
And HTML script should be:
<select name="menu1" onChange="MM_jumpMenu(this,0)">
<option></option>
<option value="link.html">link</option>
</select>
This works for new window for each link that is selected, but I want all of my links to go the same place.
Also, how do I create a selection that does NOT open a link. When I click on the selection that has a # sign it opens up the parent page as a new window.
Here's a sample script that opens the link to the same window (parent):
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="#" selected>Archives</option>
<option value="link.html">link</option></select>
</form>
Staffer Stone changed it to this:
function MM_jumpMenu(selObj,restore){ //v3.0
var url = selObj.options[selObj.selectedIndex].value;
if (url) window.open(url);
if (restore) selObj.selectedIndex=0;
}
And HTML script should be:
<select name="menu1" onChange="MM_jumpMenu(this,0)">
<option></option>
<option value="link.html">link</option>
</select>
This works for new window for each link that is selected, but I want all of my links to go the same place.
Also, how do I create a selection that does NOT open a link. When I click on the selection that has a # sign it opens up the parent page as a new window.