ʵʱÏÔʾϵͳʱ¼ä
Ч¹ûÈçÏ£º
<script type="text/javascript">
??? function colok() {
?????? var now = new Date();?????? //»ñÈ¡ÈÕÆÚ¶ÔÏó
?????? var year = now.getYear();?? //»ñÈ¡Äê
?????? var month = now.getMonth(); //»ñÈ¡Ô·Ý
?????? var date = now.getDate();?? //»ñÈ¡ÈÕ
?????? var day = now.getDay();???? //»ñÈ¡ÐÇÆÚ
?????? var hour = now.getHours();? //»ñȡСʱ
?????? var minu = now.getMinutes();//»ñÈ¡·Ö
?????? var sec = now.getSeconds(); //»ñÈ¡Ãë
?????? var week;
?????? month = month + 1;
?????? if (month < 10){
?????????? month = "0" + month; //µ±Ô·ÝСÓÚ10ʱ£¬Ç°²¹Áã
?????? }
?????? if (date < 10){
?????????? date = "0" + date;?????? //µ±ÈÕÆÚСÓÚ10ʱ£¬Ç°²¹Áã
?????? }
?????? if (hour < 10){
?????????? hour = "0" + hour;?????? //µ±Ð¡Ê±Ð¡ÓÚ10ʱ£¬Ç°²¹Áã
?????? }
?????? if (minu < 10){
?????????? minu = "0" + minu;?????? //µ±·ÖÖÓСÓÚ10ʱ£¬Ç°²¹Áã
?????? }
?????? if (sec < 10){
?????? ??? sec = "0" + sec;???? //µ±ÃëСÓÚ10ʱ£¬Ç°²¹Áã
?????? }
?????? var arr_week = new Array("ÐÇÆÚÈÕ", "ÐÇÆÚÒ»", "ÐÇÆÚ¶þ", "ÐÇÆÚÈý", "ÐÇÆÚËÄ", "ÐÇÆÚÎå",
????????????? "ÐÇÆÚÁù");
?????? week = arr_week[day];
?????? var time = "";
?????? time = year + "Äê" + month + "ÔÂ" + date + "ÈÕ " + week + " " + hour + ":"
????????????? + minu + ":" + sec;//Æ´½ÓÏÔʾµÄ×Ö·û´®
?????? document.getElementById("time").innerHTML = "[" + time + "]";
?????? var timer = setTimeout("colok()", 1000);//ÿ¸ô1000ºÁÃë×Ô¶¯Ö´Ðк¯Êý
??? }
</script>
??? </head>
??? <body onLoad="colok()">
?????? <div id="time"></div>
</body>