<script>
//获取id,倒数值,速度,设定定时器,函数,倒数值减,页面文字,如果小于倒数值,页面跳转;大于,不跳转,继续执行;
vardemo =
document.getElementById("demo");
varcount =
5;
varspeed =
1000;
setTimeout(Index,speed);
functionIndex(){
count--;
demo.innerHTML=
"<a href='http://www.baidu.com'>页面将在"+count+"秒钟后跳转到首页</a>";
if(count
<= 0){
window.location.href=
"http://www.baidu.com";
}else{
setTimeout(Index,speed);
// 递归调用,自己调用自己;
}
}
</script>