Simple Timer

[Total: 0    Average: 0/5]

This will ask the user for a time (minutes) to count down.

Body Code:

<script language="JavaScript">
<!--
  var alarmId;
  function alarmFunc() {
    // Sound the alarm call. You could play a sound here
    // as well, by using location=soundfile, etc.
    alert("ALARM CALL!");
  }
  function startTimeout(id) {
    var minutes = prompt("How many minutes?", 0);
    // Time-outs are measured in milliseconds, so if the
    // user enters 1 minute, we need to multiply by 60000.
    alarmId = setTimeout("alarmFunc()", minutes*60000);
}
//-->
</script>
<center>

<form>
<input type=button 
       value="Start"  
       onClick="startTimeout()">
<input type=button value="Cancel"
onClick="clearTimeout(alarmId)">
</center>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *