我正在尝试关闭 Iframe,下面的内容适用于除 IE7 和 IE8 之外的所有浏览器。对IE有什么建议吗?该按钮实际上存在于 iframe 本身上。
<input type="submit" onclick="history.go(0)"
最佳答案
除了删除它之外,我不知道“关闭”对于 iframe
意味着什么,所以:
您可以在其父节点上使用 removeChild
从文档中删除 iframe
,例如:
var iframe = window.parent.document.getElementById('theIframe');
iframe.parentNode.removeChild(iframe);
我使用 id
在父窗口中查找 iframe
元素,但显然您有很多选择来查找它。最终归结为调用 removeChild
.
关于javascript - 在 IE 中使用 Javascript 关闭 Iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5548675/