-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (40 loc) · 1.09 KB
/
index.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>canvas时钟</title>
<style type="text/css">
body{
background-color:#f8f8f8;
}
p{text-align: center;
display:block;
font:400 20px/20px "Arial";
margin-top:200px;}
div{
text-align: center;
margin-top:50px;
}
canvas{
border:1px solid transparent;
}
</style>
</head>
<body>
<p></p>
<div>
<canvas id="clock" height="240px" width="240px"></canvas>
</div>
<script src="js/clock.js" type="text/javascript"></script>
<script type="text/javascript">
var date = new Date();
var day=['日','一','二','三','四','五','六'];
var year=date.getFullYear();
var mon=date.getMonth()+1;
var data =date.getDate();
var weekday=day[date.getDay()];
var p=document.getElementsByTagName("p")[0];
p.innerHTML= '今天是 '+ year +' 年 '+mon+' 月 '+data+' 号 星期'+weekday+''
</script>
</body>
</html>