页面实现自动刷新的3种方式

1.页面自动刷新:把如下代码加入<head>区域中

<meta http-equiv="refresh" content="20">,其中20指每隔20秒刷新一次页面.

2.页面自动跳转:把如下代码加入<head>区域中

<meta http-equiv="refresh" content="20;url=http://www.hackhome.com">,其中20指隔20秒后跳转到http://www.hackhome.com页面

3.页面自动刷新js版

<script language="JavaScript">
function myrefresh(){
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>

w3c 关于setTimeout()的使用介绍:

包含有无穷循环函数 

http://www.w3school.com.cn/jsref/met_win_settimeout.asp

http://www.runoob.com/jsref/met-win-settimeout.html

setInterval(code,millisec[,"lang"]):设置循环执行

http://www.w3school.com.cn/jsref/met_win_setinterval.asp

posted @ 2016-11-09 22:09  aWolfMan  阅读(2939)  评论(0编辑  收藏  举报