I'm using the code below in the parent window to toggle a layer in the parent window that displays an inline iframe within the <div> tags. However, I would like to provide a link to close this div tag from within the iframe as well.
in parent window:
<script type="text/javascript">
function toggleLayer( whichLayer )
{
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( whichLayer );
else if( document.all ) // this is the way old msie versions work
elem = document.all[whichLayer];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[whichLayer];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
</script>
toggling on parent window with:
<a href="javascript:;" onClick="javascript:toggleLayer('div1')">email</a>
This code doesn't do anything when placed in the iframe as well.



Reply With Quote

I didn't think that was possible. It worked on my end.

Bookmarks