Entry
How do I hide a layer in parent window from inside an iframe?
Sep 2nd, 2007 13:37
Dave Clark, Yeagz Yeagz,
For example, when I click the hyperlink below, I want it to hide a
particular layer in the parent window...however, I'm inside an iframe
and don't know how to pass the parent layer's div id
(stock_exp_close)...nothing happens.
document.write('<a href="_php/stock_sym_export.php?
stocksymbols='+stocksymbols+'" onclick="toggle_layer
("stock_exp_close");">Yes</a>');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yeagz,
If I understand your setup, a variation on the following function
should do the trick:
function toggle_layer(id)
{
var obj = parent.document.getElementById(id);
if (obj)
{
if (obj.style.display == 'none')
{
obj.style.display = '';
}
else
{
obj.style.display = 'none';
}
}
return true;
}
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~