jsカウントダウンを実現する(距離終了と)サンプルコード
1792 ワード
<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>
<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>