News Focus
News Focus
Replies to #317 on Vendit's Area 51
icon url

Vendit

05/19/01 7:53 PM

#318 RE: Vendit #317

Pull-down menu for frames script
(A sample of this menu is on the left frame)
Firstly, credit where credit is due, this script was written by Prof. Joe Burns of HTML Goodies fame. No, he didn't write it for me, he posted it on his famous web site and I am posting it here with some additional instructions. (Hopefully that's OK with him ^^;)

Any ways, copy and paste this to the <HEAD> section of your page:


<SCRIPT LANGUAGE="JavaScript">

function acrossFrames()
{

if (document.FrameForm.DDFrameForm.options[0].selected)
parent.frames[0].location='your_link1.html'

if (document.FrameForm.DDFrameForm.options[1].selected)
parent.frames[1].location='your_link2.html'

if (document.FrameForm.DDFrameForm.options[2].selected)
parent.frames[1].location='your_link3.html'

if (document.FrameForm.DDFrameForm.options[3].selected)
parent.frames[1].location='your_link4.html'

if (document.FrameForm.DDFrameForm.options[4].selected)
parent.frames[1].location='your_link5.html'

}

</SCRIPT>


Don't forget to change the "your_linkx" part to your URL!
Please note this pat of the code:

if (document.FrameForm.DDFrameForm.options[0].selected) parent.frames[0].location='your_link1.html'
Option 0, 1, 2, 3 etc, are the menu items, like SMZ, SM Toolbox etc, the more interesting part is parent.frames[0], parent.frames[1] etc. these refer to different frames, parent.frames[0] is the frame the script is in, parent.frames[1] is the next frame. If you only have two frame windows you just use parent.frames[1] all the time, except for the first item (ie. keep parent.frames[0]), if you have three frame windows, you can use parent.frames[2], to send the link to the third frame. Confused? Let me try to clarify that a little:

parent.frames[0] links to the frame window the script is in (frame number 0)
parent.frames[1] links to the next frame (frame no. 1)
parent.frames[2] links to the next frame after frame no.1 (frame no. 2)
etc.
Put this in the BODY section of your page, where you want the menu to be:

<FORM NAME="FrameForm">
<SELECT NAME="DDFrameForm">
<OPTION SELECTED> --> Pick One <--
<OPTION>your page
<OPTION>SMZ
<OPTION>Anime Zone
<OPTION>Ranma 1/2 Zone
</SELECT>
<INPUT TYPE="button" VALUE="GO" onClick="acrossFrames()">
</FORM>


Replace the names of my sites with those of yours.

http://pixelz.amhosting.com/toolbox/frame_pull_dn_menu.html



Reid