<script type="text/javascript" > window.onload = function () { //定义这个setTimeout 就是1秒执行一次! setTimeout(Change, 1000); }; function Change() { var time = document.getElementById("time").innerHTML; time = parseInt(time); time--; if (time<1) { var url = document.getElementById("url").href; window.location.href = url; } else { document.getElementById("time").innerHTML = time; setTimeout(Change, 1000); } } </script> </head> <body> <span style="font-size:28px;color: #ff0000" id="time">5</span><a id="url" href="Default.aspx"></a> </body> </html>