1.在中加入下列代码 复制代码 代码如下: <BR>var timerID = null; <BR>var timerRunning = false; <BR>function stopclock (){ <BR>if(timerRunning) <BR>clearTimeout(timerID); <BR>timerRunning = false;} <BR>function startclock () { <BR>stopclock(); <BR>showtime();} <BR>function showtime () { <BR>var now = new Date(); <BR>var hours = now.getHours(); <BR>var minutes = now.getMinutes(); <BR>var seconds = now.getSeconds() <BR>var timeValue = "" +((hours >= 12) ? "下午 " : "上午 " ) <BR>timeValue += ((hours >12) ? hours -12 :hours) <BR>timeValue += ((minutes < 10) ? ":0" : ":") + minutes <BR>timeValue += ((seconds < 10) ? ":0" : ":") + seconds <BR>document.clock.thetime.value = timeValue; <BR>timerID = setTimeout("showtime()",1000); <BR>timerRunning = true;} <BR> 2.在中加入下列代码 onload=startclock() 3.在显示时间的位置插入下列代码,建议使用表格定位 [code] //只获得当前系统日期的函数 <BR>document.write(new Date().getYear()+"-"+(new Date().getMonth()+1)+"-"+new Date().getDate()); <BR>http://www.jb51.net/article/12786.htm