<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>系统时间</title> <script language="javascript" type="text/javascript"> <!-- //获得当前时间,刻度为一千分一秒 var initializationTime=(new Date()).getTime(); function showLeftTime() { var now=new Date(); var year=now.getYear(); var month=now.getMonth(); var day=now.getDate(); var weekday=now.get var hours=now.getHours(); var minutes=now.getMinutes(); var seconds=now.getSeconds(); document.all.show.innerHTML=""+year+"年"+month+"月"+day+"日 "+hours+":"+minutes+":"+seconds+""; //一秒刷新一次显示时间 var timeID=setTimeout(showLeftTime,1000); } function showtime() { var date = new Date(); this.year = date.getFullYear(); this.month = date.getMonth() + 1; this.date = date.getDate(); this.day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()]; this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); var currentTime = "现在是:" + this.year + "年" + this.month + "月" + this.date + "日 " + this.hour + ":" + this.minute + ":" + this.second + " " +"("+ this.day+")"; document.all.show.innerHTML=currentTime; var timei=setTimeout(showtime,1000);} //--> </script> </head> <body onload="showtime()"> <label id="show">显示时间的位置</label> </body> </html>