倒計時載入頁面
作者:晉城網(wǎng)站建設(shè) 日期:2010-02-15
演示截圖:
腳本說明:
第一步:把如下代碼加入<head>區(qū)域中:
<META HTTP-EQUIV="REFRESH" CONTENT="11; URL=http://m.jinjiusolutions.com.cn">
第二步:把<body>中加入如下代碼:
<META HTTP-EQUIV="REFRESH" CONTENT="11; URL=http://m.jinjiusolutions.com.cn">
<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= mySecs1.substring(0,mySecs1.indexOf(".")) + " secs.";
document.form1.timespent.value = mySecs1
window.setTimeout('getSecs()',1000);
}
</script>
<center>
This page will change in 10 seconds:
<form name=form1><input size=9 name=timespent></form>
</center>
第三步:把<body>中內(nèi)容改為:
<body bgcolor="#fef4d9" onLoad="window.setTimeout('getSecs()',1)">