【发布时间】:2013-07-20 05:44:07
【问题描述】:
我需要在 5000 毫秒后停止加载我的 iframe 页面,我正在使用这些,但它每 5000 毫秒刷新一次 iframe,这是什么问题。请修复它。谢谢
<iframe id="iframe1" src="" width="920" height="900" border="2"></iframe>
<script type="text/javascript">
function setIframeSrc() {
var s = "http://lx5.in/CGIT-Results-p2-2013.php";
var iframe1 = document.getElementById('iframe1');
if ( -1 == navigator.userAgent.indexOf("MSIE") ) {
iframe1.src = s;
setTimeout(setIframeSrc, 5000);
}
else {
iframe1.location = s;
setTimeout(setIframeSrc, 5000);
}
}
setTimeout(setIframeSrc, 5000);
</script>
【问题讨论】:
-
你为什么要
setiframe src 而不是在你想停止它时删除它?
标签: javascript iframe settimeout