-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path9.html
More file actions
37 lines (36 loc) · 1.1 KB
/
9.html
File metadata and controls
37 lines (36 loc) · 1.1 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>倒计时载入页面</title>
<META HTTP-EQUIV="REFRESH" CONTENT="11; URL=http://www.wangxios.com">
<script language="JavaScript">
//获取当前时间
startday = new Date();
clockStart = startday.getTime();
function initStopwatch()
{
var myTime = new Date();
var timeNow = myTime.getTime();
var timeDiff = timeNow - clockStart; //获取间隔时间
this.diffSecs = timeDiff/1000; //因为时间以毫秒为单位
return(this.diffSecs); //返回间隔秒数
}
function getSecs()
{
var mySecs = initStopwatch();
var mySecs1 = ""+mySecs;
//以倒计时方式显示时间
mySecs1= 10 - eval(mySecs1.substring(0,mySecs1.indexOf("."))) + "秒";
document.form1.timespent.value = mySecs1;
window.setTimeout('getSecs()',1000);
}
</script>
</head>
<body bgcolor="#ffffff" onLoad="window.setTimeout('getSecs()',1)">
<center>
10秒后将加载页面:
<form name=form1><input size=9 name=timespent></form>
</center>
</body>
</html>