<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 60*60;//60*60 //一個小時,按秒計算,自己調整!
function CountDown(){
if(maxtime>=0){
//minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
//msg = "距離結束還有"+minutes+"分"+seconds+"秒";
msg = "距離結束還有"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60){
alert('注意,還有5分鐘!');
}
--maxtime;
}else{
clearInterval(timer);
//alert("時間到,結束!");
maxtime=60*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="color:red"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 5*60;//60*60 //一個小時,按秒計算,自己調整!
var timer;
function CountDown(){
if(maxtime>=0){
var minutes = Math.floor(maxtime/60);
var seconds = Math.floor(maxtime%60);
var msg = "距離刷新還有"+minutes+"分"+seconds+"秒";
$('#timer').html(msg);
//document.all["timer"].innerHTML=msg;
--maxtime;
}else{
clearInterval(timer);
//一下兩個方法是倒計時結束後調用的方法
searchTaskList();
myajax();
//設置下一次的倒計時
maxtime=5*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="display:inline;color:red"></div>