Drop Down Menu With Frames
A drop down menu can be targeted to another frame. For example, suppose that you have a dropdown in the upper frame of a framed page, and you want to target it at the lower frame. We might create this sort of frameset with the following code. Notice that we name the lower frameMAIN:
<FRAMESET ROWS="35%,*"> <FRAME SRC="ddf.titlebar.html" NAME=TITLEBAR> <FRAME SRC="ddf.lower.html" NAME=MAIN> <NOFRAMES>NOFRAMES stuff </NOFRAMES> </FRAMESET>
To create a drop down menu in the upper frame, we'll use the same script as described in the previous page. Copy the
following script exactly as-is into the <HEAD>
<SCRIPT TYPE="text/javascript">
<!--
function dropdown(mySel)
{
var myWin, myVal;
myVal = mySel.options[mySel.selectedIndex].value;
if(myVal)
{
if(mySel.form.target)myWin = parent[mySel.form.target];
else myWin = window;
if (! myWin) return true;
myWin.location = myVal;
}
return false;
}
//-->
</SCRIPT>
The dropdown will use a select form like in the previous example. To target the dropdown at the lower frame we'll make one small change. In the
<FORM ...>TARGETMAIN frame:
| this code | produces this |
<FORM ACTION="../cgi-bin/redirect.pl" METHOD=POST onSubmit="return dropdown(this.gourl)" TARGET=MAIN > <SELECT NAME="gourl"> <OPTION VALUE="">Choose a Destination... <OPTION VALUE="ddf.lower.html">Home <OPTION VALUE="ddf.user.html">User Manuals <OPTION VALUE="ddf.resume.html">Resume <OPTION VALUE="ddf.contact.html">Contacts </SELECT> <INPUT TYPE=SUBMIT VALUE="Go"> </FORM> |
the dropdown in this page |
This select works almost the same as that in the
previous page. The Javascript checks if the <FORM ...>TARGETTARGET
Copyright 1997-2002 Idocs Inc.
