Web页面动态刷新时间

        function realSysTime(clock){ 
     	   var now=new 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();
     	   if(Number(sec)<10){
     		   sec="0"+sec.toString();
     	   }
     	   month=month+1; 
     	   var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); 
     	   var week=arr_week[day]; 
     	   var time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec; //组合系统时间 
     	   clock.innerHTML=time;
     	} 
     	window.οnlοad=function(){ 
     	   window.setInterval("realSysTime(clock)",1000);
     	}
	

页面动态刷新时间,每秒刷新一次。


你可能感兴趣的:(学习记录)