windows对象-定时器小例子
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
恭喜您,注册成功,在<span id="second" style="color:red;">5</span>秒后将跳到首页,若没有跳转,请<a href="./NewFile3.html" style="color:blue;">点击这里</a>
</body>
<script>
var time=5;
var timer;
timer=setInterval(function(){
var sec=document.getElementById("second");
if(time>=1){
sec.innerHTML=time;
time--;
}else{
clearInterval(timer)//清除定时器任务
location.href="./NewFile3.html";//加载页面
}
},1000);
</script>
</html>
菜鸟在成长