title: How to stop timer after the the countdown is over
body: <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Countdown&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  // set minutes
  var mins = 1;
  
  // calculate the seconds (don't change this! unless time progresses at a different speed for you...)
  var secs = mins * 60;
  function countdown() {
      setTimeout('Decrement()',1000);
  }
  function Decrement() {
      if (document.getElementById) {
          minutes = document.getElementById("minutes");
          seconds = document.getElementById("seconds");
          // if less than a minute remaining
          if (seconds &lt; 59) {
              seconds.value = secs;
          } else {
              minutes.value = getminutes();
              seconds.value = getseconds();
          }
          secs--;
          setTimeout('Decrement()',1000);
      }
  }
  function getminutes() {
      // minutes is seconds divided by 60, rounded down
      mins = Math.floor(secs / 60);
      return mins;
  }
  function getseconds() {
      // take mins remaining (as seconds) away from total seconds remaining
      return secs-Math.round(mins *60);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="timer"&gt;
      Time Left: 00:&lt;input id="minutes" type="text" style="width: 20px; border: none; background-color:none; font-size: 16px; font-weight: bold;"&gt;:&lt;input id="seconds" type="text" style="width: 26px; border: none; background-color:none; font-size: 16px; font-weight: bold;"&gt;
  &lt;/div&gt;
  &lt;script&gt;
  countdown();
  &lt;/script&gt;
  </code></pre>
  
  <p>In this java script code the timer get executing after the time is over and time goes in minus example (00-1:30).
  So I want to stop the timer when it reaches the 00:00. And it should give alert when the time is completed or submit the page.</p>