您的位置:首页 > Web前端 > JavaScript

js定时执行Iframe页面刷新

2018-02-24 16:10 603 查看
<iframe id="armchatroom" width="100%" frameBorder="0" src="c.php" scrolling="no"></iframe>
<input type="button" onclick="javascript:chatIframeStop();" value="stop Refresh" />
<script type="text/javascript">
var chatIframeTimer = setInterval("chatIframeReload()",5000);//1000为1秒钟
function chatIframeReload()
{
document.getElementById('armchatroom').contentWindow.location.reload(true);
}
function chatIframeStop()
{
if(chatIframeTimer)
{
window.clearTimeout(chatIframeTimer);
}
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: