I'm searching for an example with an client timer that ticks synchronous with 开发者_开发问答an server timer. Also there must be a button on the client side which can reset the server timer to an default value, and with this it also resets the client timer ofcourse.
I tried it myself but it seems that there is some postback delay which makes it impossible for me to make it atleast look like it goes synchronous.
I hope somebody got an example for me, the button part is really important because by pressing that button the delay comes.
Thanks in advance,
Julian
write server offset into response like JSON or any other way and use it as parameter for next method
function getServerTime(serverOffset) { var myDate=new Date(); myDate.setDate(myDate.getTime()+(serverOffset*60*60*1000)); return myDate; }
this method you can call each second and put returned value where ever you want.
精彩评论