倒计时载入页面

演示截图:

脚本说明:
第一步:把如下代码加入<head>区域中:
 <META HTTP-EQUIV="REFRESH" CONTENT="11; URL=http://www.87511.cn">


第二步:把<body>中加入如下代码:
 <META HTTP-EQUIV="REFRESH" CONTENT="11; URL=http://www.87511.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>中内容改为:
<body bgcolor="#fef4d9" onLoad="window.setTimeout('getSecs()',1)">

 



Tags: ,山西晋城网站建设,晋城在线网页学习,晋城企业智能建站