title: how to show the alert box when half of the time finished in online exam using javascript
body: <p>i am doing online exam. I set the timer for exam using javascript. that is working perfect.i have little knowledge in javascript. i don't know how to show the alert box when the half of the test over. Please give the solution to me.</p>
  
  <p>My code for timer:</p>
  
  <pre><code>function countDown() {
        sec--;
    if (sec == -01) {
      sec = 59;
      min = min - 1;
      if(min==-01)
          {
              min=59;
              hour=hour-1;
          }else
              {
                  hour=hour;
              }
    } else {
     min = min;
    }
  if (sec&lt;=9) { sec = "0" + sec; }
  
    time = (hour&lt;=9 ? "0" + hour : hour) + " : " + (min&lt;=9 ? "0" + min : min) + " : " + sec + "";
  if (document.getElementById) { document.getElementById('timer').innerHTML = time; }
    SD=window.setTimeout("countDown();", 1000);
  if (hour=='00'&amp;&amp; min == '00' &amp;&amp; sec == '00') { sec = "00";min="00"; window.clearTimeout(SD); window.location=document.forms[0].action+"?fs=yes";}
  }
  
  function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
      window.onload = func;
    } else {
      window.onload = function() {
        if (oldonload) {
          oldonload();
        }
        func();`enter code here`
      }
    }
  }
  </code></pre>