效果: 目前時間: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(>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>// --> 複製程式碼 程式碼如下: 關鍵地方。