定时刷新页面的方法

方法1

<meta http-equiv=refresh content="2; url=test.asp">
content 是间秒数

方法2 

<script language="javascript">
<!--
var limit="0:05"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}

function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" min "+cursec+" sec "
else
curtime=cursec+" sec "
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh
var now=new Date()
document.write("现在是"+now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日"+now.getHours()+"时"+now.getMinutes()+"分"+now.getSeconds()+"秒")
//-->
</script>

加到body中间,这里是0:05为5秒钟,可以自定,比如3:00表示3分钟



文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.