I don't know if there is such code before. I was not satisfied after searching for a long time on the Internet, so I wrote this code. It is easy to implement. You don't have to read the server time again. Just read it once.
<SCRIPT language = javascript> <! -- Var now = new Date (2001,02, 01,10, 10, 00); // enter the current server time here to function CurentTime () {var mm = now. getMinutes (); var ss = now. getTime () % 60000; ss = (ss-(ss % 1000)/1000; var clock = now. getHours () + ':'; if (mm <10) clock + = '0'; clock + = mm + ':'; if (ss <10) clock + = '0'; return (clock + ss);} function refresh () {document. getElementById ("clock "). innerHTML = now. getYear () + "year" + now. getMonth () + "month" + now. getDate () + "day" + CurentTime (); now. setSeconds (now. getSeconds () + 1);} setInterval ('refresh () ', 1000); // --> SCRIPT <p id = "clock"> </p>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]