1,对应得脚本。

  1. <script type="text/javascript">     
  2.                  function skip(sec,url){     
  3.                        
  4.                             document.getElementById("to").innerHTML=sec+"秒后自动跳转";     
  5.                             if(sec==0) 
  6.                              document.getElementById("to").innerHTML="正在转入...";    
  7.                        if(--sec>=0){     
  8.                             setTimeout("skip("+sec+",'"+url+"')",1000);     
  9.                                      }     
  10.                        else{       
  11.                             location.href=url;     
  12.                             }     
  13.                          }     
  14.  </script> 

2.html代码,<%=url%>为将要跳转的url。

 

  1. <div> 
  2.                 <a href="<%=url%>"><span id="to">5秒后自动跳转</span>到指定页面.如果没有自动转入,也可以手动转入.</a> 
  3.                <script type="text/javascript">skip(5,'<%=url%>');</script> 
  4.                    </div>