how to show the alert box when half of the time finished in online exam using javascript -


i doing online exam. set timer exam using javascript. working perfect.i have little knowledge in javascript. don't know how show alert box when half of test over. please give solution me.

my code timer:

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<=9) { sec = "0" + sec; }    time = (hour<=9 ? "0" + hour : hour) + " : " + (min<=9 ? "0" + min : min) + " : " + sec + ""; if (document.getelementbyid) { document.getelementbyid('timer').innerhtml = time; }   sd=window.settimeout("countdown();", 1000); if (hour=='00'&& min == '00' && 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`     }   } } 

i think have total number of questions you. when user answering each question u can increment temp variable. check whether temp equals half of total questions u can give alert.

like . alert("half of test completed");


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -