<!--
var maxtime = 60*60 //一个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
minutes = Math.floor(maxtime/60)
seconds = Math.floor(maxtime%60)
minutes = minutes>=10?minutes:'0'+minutes
seconds = seconds>=10?seconds:'0'+seconds
msg = "距离结束还有"+minutes+"分"+seconds+"秒"
document.all["timer"].innerHTML=msg
if(maxtime == 5*60) alert('注意,还有5分钟!')
--maxtime
}
else{
clearInterval(timer)
alert("时间到,结束!")
}
}
timer = setInterval("CountDown()",1000)
//-->
</SCRIPT>
<meta charset="utf-8">
<div id="timer" style="color:red"></div>
var t=60var a=setInterval(daojishi,1000)//1000毫秒
function daojishi(){
t--
//刷新时间显示
if(t==0){
clearInterval(a)
//倒计时结束
}
}