<script type="text/javascript">
//使用setInterval计时器
var a = window.setInterval(add,1000);
function add(){
//从标签ckx中获取t元素
var t = document.getElementById('ckx').innerHTML;
//利用if语句进行数字递减
if(t>0){
t--;
document.getElementById('ckx').innerHTML=t;
}else if(t == 0){
window.open("http://www.baidu.com",'_self');
clearInterval(a); //关闭计时器
}
}
</script>
<script type="text/javascript"> var num=5; setTimeout("text",1000); function clock(){ ducument.getElementById("text").value=num; num--; var t=setTimeout("text",1000); if (num==0){ clearTimeout(t); window.location.href="http://www.imook.com"; } } </script>