网页显示时间代码如下:
<test.html>
<html> <body> <SCRIPT language=javascript> function CurentTime(){ var now = new Date(); var hh = now.getHours(); var mm = now.getMinutes(); var ss = now.getTime() % 60000; var ms = ss % 1000; ss = (ss - (ss % 1000)) / 1000; var clock = hh+‘:‘; if (mm < 10) clock += ‘0‘; clock += mm+‘:‘; if (ss < 10) clock += ‘0‘; clock += ss; clock += ‘.‘; if (ms < 10) clock += ‘0‘; if (ms < 100) clock += ‘0‘; clock += ms; return(clock); } function refreshCalendarClock(){ document.all.calendarClock.innerHTML = CurentTime(); } document.write(‘<font id="calendarClock" style="color:#000000;font-family:Arial;font-size:120pt"><b> </b></font>‘); setInterval(‘refreshCalendarClock()‘,1); </SCRIPT> </body> </html>
效果如下: