js 카운트다운 실현(거리 종료 및)예시 코드

1691 단어 js카운트다운
 
<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>

좋은 웹페이지 즐겨찾기