<strong>setInterval版</strong> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="34672" class="copybut" id="copybut34672" onclick="doCopy('code34672')"><u>复制代码</u></a></span>代码如下:</div> <div class="codebody" id="code34672"> <br>$(function ( ) { <br>setInterval(function () { <br>var time = $("#time").text(); <br>time = parseInt(time); <br>time--; <br>if (時間 > 0) { <br>$("#time").text(time); <br>} else { <br>window.location = $("#url").attr("href") ; <br>} <br>}, 1000); <br><br> </div> <br>SetTimeOut バージョン<strong> </strong><br><div class="codetitle"><span><a style="CURSOR: pointer" data="26386" class="copybut" id="copybut26386" onclick="doCopy('code26386')">复制代码<u></u></a>代码如下:</span></div> <div class="codebody" id="code26386"><script type="text/javascript"> <br>window.onload = function () { <br>setTimeout(changeTime, 1000); <br>} <br>function changeTime() { <br>var time = document.getElementById("time").innerHTML; <br>時間 = parseInt(時間); <br>時間--; <br>if (time var url = document.getElementById("url").href; <br>window.location = URL; <br>} else { <br>document.getElementById("time").innerHTML= time; <br>setTimeout(changeTime, 1000); <br>} <br>} <br></script> <br><br> </div>html <br><br><div class="codetitle"><span><a style="CURSOR: pointer" data="4359" class="copybut" id="copybut4359" onclick="doCopy('code4359')">复制代码<u></u></a>代码如下:</span></div> <div class="codebody" id="code4359">< span style="font-size: 18px; color: Red" id="time">5</span>秒钟以后跳转到 <a href="<%=this.url %>" <br><br> </div>