js 代码
<script type="text/javascript"> function delayURL(url) { var delay = document.getElementById("cutdown").innerHTML; //取到id="cutdown"的对象,.innerHTML取到对象的值 if (delay > 0) { delay--; document.getElementById("cutdown").innerHTML = delay; } else { window.top.location.href = url; //跳转到URL } setTimeout("delayURL('" + url + "')", 1000); //delayURL() 就是每间隔1000毫秒 调用delayURL(url); } </script>
html 代码
<span> <b id="cutdown">6</b> 秒自动跳转到<a href="http://passport.luyou666.com/Account/Logon">登录</a>页 </span> <script type="text/javascript"> delayURL("http://passport.luyou666.com/Account/Logon"); //arti </script>