script language="javascript"> function realSysTime(clock){ var now=new Date(); //創(chuàng)建Date對象 var year=now.getFullYear(); //獲取年份 var month=now.getMonth(); //獲取月份 var date=now.getDate(); //獲取日期 var day=now.getDay(); //獲取星期 var hour=now.getHours(); //獲取小時 var minu=now.getMinutes(); //獲取分鐘 var sec=now.getSeconds(); //獲取秒鐘 month=month+1; var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); var week=arr_week[day]; //獲取中文的星期 var time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec; //組合系統(tǒng)時間 clock.innerHTML=time; //顯示系統(tǒng)時間 } window.onload=function(){ window.setInterval("realSysTime(clock)",1000); //實時獲取并顯示系統(tǒng)時間 } /script>