华光国防教育基地贴吧:怎样设定定时自动刷新?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/07 17:10:33
在已经打开的某一网页,想设定每隔5分钟(具体时间由自己设定)就自动刷新一次,怎样操作呢?
一楼的朋友,可以帮我吗?如果搞定,再加分。谢谢!

把下面的代码保存为 a.htm ,然后用IE打开就行了。我自己写的有问题再调试,其中的连接地址和时间间隔自己改:

<html>
<head >
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>casonery</title>
</head>
<p><iframe name="I1" width=800 height=600 target="_blank">浏览器不支持嵌入式框架</iframe></p>

<body onload="newtext()">
<script language=javascript >
var text=document.title;
var timerID;
function newtext() {
clearTimeout(timerID);
window.top.frames["I1"].location.href = "http://www.baidu.com";
timerID = setTimeout("newtext()",6000); // 6 秒
}
</script>
</body>
</html>

写一段脚本代码.你到网上找找看