forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonclock.JS
More file actions
25 lines (25 loc) · 725 Bytes
/
onclock.JS
File metadata and controls
25 lines (25 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function clockon(bgclock){
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;
if(date<10) date="0"+date;
if(hour<10) hour="0"+hour;
if(minu<10) minu="0"+minu;
if(sec<10) sec="0"+sec;
var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
week=arr_week[day];
var time="";
time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec;
if(document.all){
bgclock.innerHTML="<b>"+time+"</b>"
}
var timer=setTimeout("clockon(bgclock)",200);
}