var RenderTO, Hours=0, Minute=0, Second=0, cl_synctime,cl_delta; function SetClock() { var cl_localtime=new Date(); cl_localtime.setTime(cl_localtime.getTime()+cl_delta); Hours = cl_localtime.getHours(); Minute = cl_localtime.getMinutes(); Second = cl_localtime.getSeconds(); delete cl_localtime; } function ClockHalfSecond() { setTimeout('ClockHalfSecond()',1000); SecondHalf = 0; Second++; if (Second>59) { Second = 0; Minute++; if (Minute>59) { Minute = 0; Hours++; if (Hours>23) { Hours = 0; } } } cl_synctime++; if(cl_synctime>120){SetClock();cl_synctime=0;} RenderClock(); } function RenderClock() { if (RenderTO) { RenderTO.innerHTML = Hours+":"+((Minute<10)?'0'+Minute:Minute)+":"+((Second<10)?'0'+Second:Second)+"  "; } } function time_(qq){ RenderTO = qq; var dtmclock; for(var i=0;i<21;i++){ dtmclock = document.getElementById("ctl"+(i<10?"0"+i:i)+"_dtmSystemTime"); if(dtmclock!=null)break; } var reg=/(\d{2}).(\d{2}).(\d{4}).(\d{2}).(\d{2}).(\d{2})/ ; var arr=reg.exec(dtmclock.innerHTML); var cl_localtime0=new Date(); var cl_localtime=new Date(arr[3],arr[2]-1,arr[1],arr[4],arr[5],arr[6]); cl_delta=cl_localtime.getTime()-cl_localtime0.getTime(); cl_synctime=0; SetClock(); ClockHalfSecond(); }