效果: 当前时间:2011年6月20日 星期一12:0:19 复制代码 代码如下: <!-- <BR>function getTimeNow() { <BR>var time = new Date(); <BR>var hour = time.getHours(); <BR>var minute = time.getMinutes(); <BR>var second = time.getSeconds(); <br><br>var week; var date; <BR>if(time.getDay()==0) week="星期日"; <BR>if(time.getDay()==1) week="星期一"; <BR>if(time.getDay()==2) week="星期二"; <BR>if(time.getDay()==3) week="星期三"; <BR>if(time.getDay()==4) week="星期四"; <BR>if(time.getDay()==5) week="星期五"; <BR>if(time.getDay()==6) week="星期六"; <BR>date=(time.getYear())+"年"+(time.getMonth()+1)+"月"+time.getDate()+"日"+" "; <br><br>document.getElementById("nowTime").innerHTML ="当前时间:"+date+week+ hour+":"+minute+":"+second; <BR>setTimeout("getTimeNow()",1000); <br><br>} <BR>// --> 复制代码 代码如下: 关键地方。