PDA

View Full Version : Identify a frame as element



Yukoner
11-11-2006, 01:31 AM
1) Script Title: Drop Down Tab Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/droptabmenu.htm

3) Describe problem: This script will identify an element like a form and hide it when it drops down. There is a place to identify the element in the script and then you name the element to match.

I would like to use this script on a header frame and have it target the main frame, but will need it to hide the lower frame. Is there a way to identify the lower frame as an element so this script can drop down over it?

jscheuer1
11-11-2006, 06:09 AM
A frame may be identified as an element by id or name and accessed to change its visibility style property in FF and in IE (version 7 tested) but, will not work in Opera and perhaps others. Given a frame like so on the parent page:


<frame name="myframe" src="whatever.htm" />

It's element object can be accessed like so:


parent.document.getElementsByName('myframe')[0]

for visibility (to hide):


parent.document.getElementsByName('myframe')[0].style.visibility='hidden';

to reveal:


parent.document.getElementsByName('myframe')[0].style.visibility='';

This still may not allow anything to 'drop over' it though. There are menus that can drop across frames, I still haven't figured out how those work exactly, though I have a rough idea. Perhaps you should look into one of those. Here's one:

http://www.dynamicdrive.com/dynamicindex1/hvmenu/index.htm