-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
53 lines (44 loc) · 945 Bytes
/
Copy pathtest.html
File metadata and controls
53 lines (44 loc) · 945 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
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
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
function startTime()
{
var today=new Date()
var h1=today.getHours(), h2=h1+8, h3=h1-13
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
h2=checkTimeH(h2)
h3=checkTimeH(h3)
m=checkTime(m)
s=checkTime(s)
document.getElementById('bj').innerHTML=h1+":"+m+":"+s
document.getElementById('ld').innerHTML=h2+":"+m+":"+s
document.getElementById('ny').innerHTML=h3+":"+m+":"+s
t=setTimeout('startTime()',500)
}
function checkTimeH(i)
{
if (i>23) i-=24;
if (i<0) i+=24;
return i
}
function checkTime(i)
{
if (i<10)
{i="0" + i}
return i
}
</script>
<style type="text/css">
div {display:inline-block;width:200px;height:30px;}
</style>
</head>
<body onload="startTime()">
北京时间<span id="bj"></span><br />
伦敦时间<span id="ld"></span><br />
纽约时间<span id="ny"></span>
</body>
</html>