网页显示时间代码

网页显示时间代码如下:

<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>

效果如下:


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。