<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="JavaScript"> <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%60); <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>//--> <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%60); <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> </div>