<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>
原文:http://www.cnblogs.com/q460021417/p/4444714.html