Personal feeling is completely Ajax and Ajax is not good! Isn't JavaScript more ideal for client processing?
Copy Code code as follows:
function Timer (SPAN)
{
var tmp = new Date ();
var milsecs=date.parse (Tmp.getmonth () + "-" +tmp.getday () + "-" +tmp.getfullyear () + "" +document.getelementbyid (' Lbl_ Hour '). innertext+ ":" +document.getelementbyid (' Lbl_minute '). innertext+ ":" +document.getelementbyid (' Lbl_Second ') . innertext);
var timer = new Date (Milsecs+span);
var seconds,minutes,hours,date;
if (Timer.getseconds () <10)
seconds = "0" +timer.getseconds ();
Else
seconds = Timer.getseconds ();
if (Timer.getminutes () <10)
minutes = "0" +timer.getminutes ();
Else
minutes = Timer.getminutes ();
if (timer.gethours () <10)
Hours = "0" +timer.gethours ();
Else
Hours = Timer.gethours ();
Date=timer.getdate ();
document.getElementById (' Lbl_second '). innertext = seconds;
document.getElementById (' Lbl_minute '). innertext = minutes;
document.getElementById (' Lbl_hour '). innertext = hours;
}
Get server time to check every updatespan minutes, update local clock every second
function GetServerTime (Updatespan)
{
var clientspan = 1*1000;
Update Local Clock
SetInterval ("Timer (" +clientspan+ ")", Clientspan);
Synchronizing server Clocks
SetInterval ("window.location.href= ' current URL '", Updatespan);
}