1 <div: id="clock"></div:> 2 <script> 3 function a(clock){ 4 var now =new Date(); 5 var month=now.getMonth()+1; 6 var day=now.getDay(); 7 var s=now.getSeconds(); 8 var arr=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); 9 week=arr[day]; 10 var time=month+"月 "+week+" "+s; 11 clock.innerHTML="now time:"+time; 12 } 13 window.onload=function(){ 14 window.setInterval("a(clock)", 1000); 15 } 16 </script>