如何使用javascript清除IFRAME元素的内容,而不加载空白页面?
我可以想出这样做:iframe_element.src = "blank.html"
,但必须有一个更好的、即时的方法。
发布于 2013-12-04 02:21:06
var iframe = document.getElementById("myiframe");
var html = "";
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(html);
iframe.contentWindow.document.close();
在IE、Firefox和Chrome中测试...它做到了:)
https://stackoverflow.com/questions/1785040
复制相似问题