网页显示时间代码

网页显示时间代码如下:

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

效果如下:

网页显示时间代码

网页显示时间代码

上一篇:在websphere里测试数据源出错


下一篇:跟传智播客学写web服务器软件(1)——开始监听浏览器请求并生成通信套接字