【发布时间】:2011-03-24 15:12:41
【问题描述】:
如何在 ie 6,7,8 中隐藏 iframe? style = "display:none" 的设置属性不起作用!
抱歉,我忘记发布上下文了。
iframe是由javascript动态生成的。如:
function addIframe(node) {
var iframe = document.createElement("div");
iframe.src = ****;
iframe.style = "display:none";
node.appendChild(iframe);
}
上述函数生成的隐藏帧在firefox和chrome中有效,在ie中失败。
【问题讨论】:
-
对我来说
style="display: none;"有效,但它提供了一个 javascript 异常access is denied -
使用
iframe.style.cssText = 'display:none;,或者更好的是iframe.style.display = 'none';
标签: iframe cross-browser hide