I want to create a function in jQuery that is a continous timer that calls itself every second:
I'm getting an error undefined values:
I'm getting an error undefined values:
Code:
var curloc=window.location.href; var tcorner="gtype=T"; curpos=curloc.indexOf(tcorner); // teachers corner clock if (curloc.indexOf("gtype=T")>-1){ h=0; m=0; s=0; window.setInterval(function(h,m,s) { //temptime=startclock(h,m,s).split("_"); //h=temptime[0]; //m=temptime[1]; //s=temptime[2]; s=s+1; if (s==60){ s=0; m=m+1; } if (m==60){ m=0; h=h+1; } else{ h=h; } // leading zero ds=s; if (s<10) {ds="0" + s;} dm=m; if (h==0){ dh=""; } else{ dh=h; } $(".visibleDiv").html(dh+" "+dm+":"+ds); }, 1000); }
Comment