<html>

<script type=“text/javascript”>

function display( notifier, str ) {
  document.getElementById(notifier).innerHTML = '<div align="center" style="font-size:20pt;"><strong>'+str+'</strong></div>';
}

function toMinuteAndSecond( x ) {
  var secondnum = x%60;
  var secondstr = secondnum+' ';
  var fixed = secondstr;
  if (secondstr.length == 2)
    {
     fixed = '0'+secondstr;
    }
  return Math.floor(x/60) + ":" + fixed;
}

function setTimer( remain, actions ) {
  (function countdown() {
     display("countdown", toMinuteAndSecond(remain));		
     actions[remain] && actions[remain]();
     (remain -= 1) >= 0 && setTimeout(arguments.callee, 1000);
  })();
}
setTimer(3330, {
  10: function () { display("notifier", "10 seconds"); },
   5: function () { display("notifier", "5 seconds");        },
   0: function () { display("notifier", "Time's up!");       }
});	

</script> </html>

 
wlof/timer.txt · Last modified: 2023/08/12 19:17 by 127.0.0.1
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki