.net中的动态时钟 (年月日 时分秒)

// JavaScript Document


window.onload = movetime;
function movetime(){
 var today=new Date();
 var year=today.getFullYear();
 var month = today.getMonth() + 1;
 var day = today.getDate();
 var xingqi = today.getDay();
 if (xingqi == 0) {xingqi = " 星期日"; }
 if (xingqi == 1) { xingqi = " 星期一"; }
 if (xingqi == 2) { xingqi = " 星期二"; }
 if (xingqi == 3) {xingqi = " 星期三";}
 if (xingqi == 4) { xingqi = " 星期四"; }
 if (xingqi == 5) { xingqi = " 星期五"; }
 if (xingqi == 6) { xingqi="星期六" }
 var hour=today.getHours();
 var minute=today.getMinutes();
 var second = today.getSeconds();
 if (second < 10) {
     second = "0" + second;
   
 }
 else {
     second = second;

 }
 if (minute < 10) {
     minute = "0" + minute;

 }
 else {
     minute = minute;

 }
  document.getElementById("time").innerHTML=year+"年"+month+"月"+day+"日"+xingqi+"    "+hour+":"+minute+":"+second;

 setTimeout('movetime()', 1000);
}

 

在页面进行应用 <script type="text/javascript"  src="js/aa.js" language="javascript">

posted @ 2013-05-09 16:58  李翠华  阅读(269)  评论(0编辑  收藏  举报