---
title: "js动态显示当前时间"
author: "premier_gu"
date: "2011-04-27T17:02:14Z"
tags: []
categories: ["Web前端"]
slug: "js"
draft: false
lastmod: "2011-04-27T17:02:14Z"
id: 1020255
url: "https://premier-gu.iteye.com/blog/1020255"
---

<SCRIPT language=JavaScript>
function CurentTime(){
    var now = new Date();
    var hh = now.getHours();
    var mm = now.getMinutes();
    var ss = now.getTime() % 60000;
    ss = (ss - (ss % 1000)) / 1000;
    var clock = hh+':';
    if (mm < 10) clock += '0';
    clock += mm+':';
    if (ss < 10) clock += '0';
    clock += ss;
    return(clock); }
function refreshCalendarClock(){
    document.all.calendarClock4.innerHTML = CurentTime(); }
    setInterval('refreshCalendarClock()',1000);
    document.write('&nbsp;&nbsp;<font id="calendarClock4"  style="color:#1623BF;font-family:宋体;font-size:9pt;line-height:120%"> </font>');
</SCRIPT>