-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.html
More file actions
69 lines (58 loc) · 2.19 KB
/
Copy pathclock.html
File metadata and controls
69 lines (58 loc) · 2.19 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kindle时钟</title>
<link rel="stylesheet" href="./clock.css">
</head>
<body>
<div class="contain">
<div class="content" onclick="rotate()">
<div id="time" class="bigday">loading...</div>
<div id="data" class="month"></div>
</div>
<div id="foot" class="foot">
foot
</div>
</div>
<script>
function rotate() {
var b = document.getElementsByTagName('body')[0]
if (b.className == "") {
b.className = "rotate"
} else {
b.className = ""
}
}
function refreshTime() {
var currTime = new Date();
var utc8DiffMinutes = currTime.getTimezoneOffset() + 480;
currTime.setMinutes(currTime.getMinutes() + utc8DiffMinutes);
var hh =
currTime.getHours() < 10
? "0" + currTime.getHours()
: currTime.getHours(); //获取当前小时数(0-23)
var mi =
currTime.getMinutes() < 10
? "0" + currTime.getMinutes()
: currTime.getMinutes(); //获取当前分钟数(0-59)
var ss =
currTime.getSeconds() < 10
? "0" + currTime.getSeconds()
: currTime.getSeconds(); //获取当前秒数(0-59)
var Year = currTime.getFullYear();
var Month = currTime.getMonth() + 1;
var Day = currTime.getDate();
var weekDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var weekDay = weekDays[currTime.getDay()];
var dataStr = Year + "年" + Month + "月" + Day + "日" + weekDay
document.getElementById('data').innerText = dataStr
var element = document.getElementById("time");
element.innerText = hh + ":" + mi;
}
setInterval("refreshTime()", 1000);
</script>
</body>
</html>