60秒倒计时,自动跳转到指定页面

<script type="text/javascript" charset="utf-8">
//设定倒数秒数 
var t = 60; 
//显示倒数秒数 
function showTime(){ 
t -= 1; 
document.getElementById('jumpTo').innerHTML= t; 
if(t==0){ 
location.href='http://www.baidu.com'; 
} 
//每秒执行一次,showTime() 
setTimeout("showTime()",1000); 
} 

//执行showTime() 
showTime(); 
</script>

 

posted @ 2015-04-21 16:27  Xpress  阅读(528)  评论(0编辑  收藏  举报