js定时执行Iframe页面刷新

<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> 


猜你喜欢

转载自blog.csdn.net/u011504963/article/details/79362859