-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQ.html
67 lines (66 loc) · 1.56 KB
/
Q.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>时钟</title>
<style type="text/css">
#clock{
width: 200px;
height: 200px;
position: relative;
background: url(https://bestace.github.io/fed/ppt/demos/jsBase/img/clock.jpg);
background-size: 100%;
}
#sec{
width: 2px;
height: 70px;
background-color: red;
position: absolute;
left: 108px;
top: 110px;
transform-origin: 50% top;
}
#min{
width: 2px;
height: 50px;
background-color: black;
position: absolute;
left: 108px;
top: 110px;
transform-origin: 50% top;
}
#hour{
width: 2px;
height: 40px;
background-color: black;
position: absolute;
left: 108px;
top: 110px;
transform-origin: 50% top;
}
</style>
</head>
<body>
<div id="clock"></div>
<div id="sec"></div>
<div id="min"></div>
<div id="hour"></div>
<script>
var oSec = document.getElementById("sec");
var oMin = document.getElementById("min");
var oHour = document.getElementById("hour");
function getnow()
{
now=new Date;
var hour=now.getHours();
var min=now.getMinutes();
var sec=now.getSeconds();
oSec.style.transform="rotate("+sec*6+"deg)";
oMin.style.transform="rotate("+min*6+"deg)";
oHour.style.transform="rotate("+hour*6+"deg)";
setTimeout(getnow,1000);
}
getnow();
</script>
</body>
</html>