首页 > Web开发 > 详细

网页显示时间代码

时间:2014-02-14 12:56:47      阅读:386      评论:0      收藏:0      [点我收藏+]

网页显示时间代码如下:

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

效果如下:

bubuko.com,布布扣

网页显示时间代码

原文:http://blog.csdn.net/fulinus/article/details/19161193

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!