<div class="codetitle"> <span><a style="CURSOR: pointer" data="78092" class="copybut" id="copybut78092" onclick="doCopy('code78092')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code78092"> <br><script language="Java"> <BR><!--🎜><!--🎜><!--🎜><!-- <BR>var maxtime = 60*60;//60*60 //一小時,以秒數計算,自行調整! <BR>function CountDown(){ <BR>if(maxtime>=0){ <BR>/ /minutes = Math.floor(maxtime/60); <BR>seconds = Math.floor(maxtime`); <BR>//msg = "距離結束還有" minutes "分" seconds "秒"; <BR> msg = "距離結束還有" seconds "秒"; <BR>document.all["timer"].innerHTML=msg; <BR>if(maxtime == 5*60){ <BR>alert('注意,還有5分鐘!'); <BR>} <BR>--maxtime; <BR>}else{ <BR>clearInterval(timer); <BR>//alert("時間到,結束!"); <BR>maxtime=60*60; <BR>timer = setInterval("CountDown()",1000); <BR>} <BR>} <BR>timer = setInterval("CountDown()",1000); >//--> <BR></script> <br><div id="timer" style="color:red"></div> <br><script language="JavaScript"> <BR>< !-- <BR>var maxtime = 5*60;//60*60 //一小時,以秒數計算,自行調整! <BR>var timer; <BR>function CountDown(){ <BR>if(maxtime >=0){ <BR>var minutes = Math.floor(maxtime/60); <BR>var seconds = Math.floor(maxtime`); <BR>var msg = "距離刷新還有" minutes "分" seconds "秒"; <BR>$('#timer').html(msg); <BR>//document.all["timer"].innerHTML=msg; <BR>--maxtime; <BR>} else{ <BR>clearInterval(timer); <BR>//一下兩個方法是倒數結束後呼叫的方法<BR>searchTaskList(); <BR>myajax(); <BR>//設定下一次的倒數計時<BR>maxtime=5*60; <BR>timer = setInterval("CountDown()",1000); <BR>} <BR>} <BR>timer = setInterval("CountDown()",1000); <BR>//--> <BR></script> <br><div id="timer" style="display:inline;color:red"></div> <br><br> </div>