iframe show layer in parent
- Started
- Last post
- 13 Responses
- ldww
i have a document with an iframe, inside that is a page, how can i have a button on the iframe page which "shows" a div located in the base document?
- ape0
try window.top.document.element.visi...
or window.parent
- ldww0
neither worked :(
- ldww0
ps, i did a href="javascript:window.parent.d...
- Donvitoviti0
Just use Dreamweavers Behaviors. There is a nice Show Hide Layer Behavior in there.
Go check it out.
- ldww0
that is what i tried first.
it works to hide/show the layer on the same page, but it does not hide/show a div in parent
- ldww0
thought i would give it a bump with the morning crowd... still no answer....
here is my set up:
BASE PAGE (contains div named email)> iframe > iframe > BUTTON
i want to be able to click button and it will show the email div
- versa0
function showDiv(id)
{
if(document.getElementById)
{
var div = top.document.getElementById(id);
if (div.style.display == "none")
{
div.style.display = "block";
}
else
{
return false
}
}
}
- ldww0
i have display:none (css) on my div named Email, and put that JS on the page with the button, and my button href is:
javascript:showDiv(Email);and no luck...
- versa0
try putting your div name inside single quotes for the JS function call...like showDiv('Email')....if that doesn't work.....maybe referencing the iframe id names will be necessary.....try it, i can't play with it right now....in other words incorporate the iframes id names into the path call..like:
top.document.fooIframe(id)
- ldww0
are divs not supported in mozilla/netscape? someone i know just told me that, and the script that works in ie to show them is not working for it either.
- versa0
divs ARE supported...you might be having trouble with "visibility" in netscape tho....i have run into problems there
so you got it working in IE tho with that function using display style properties?
- ldww0
i had to mess around with it... ended up getting it to work by:
function showEmail()
{ window.parent.Email.style.visibi...
}
- versa0
good show...sorry i'm half helping
try using the display style prop instead of the visibility...i am guessing that is the problem in netscape, and possibly Moz