日期:2014-05-16  浏览次数:20445 次

Js 3秒钟跳转页面
       
        某个操作成功以后,3秒钟自动跳转到其他页面.

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<html>
         <head>  
             <script type="text/javascript">
                    var i = 4 ;
                    function show(){                              
                       i-=1 ;
                       document.getElementById('show').innerHTML=i ;
                       if(i   ==   1)
                       {
                       window.location.href='http://yuelangyc.iteye.com';
                       }
                       window.setTimeout("show()",1000);           
                    }          
             </script>

         </head>

         <body onload="show();">
                    注册成功! <div id="show"></div>秒钟之后,自动跳转<br>
                       <%                           

                             response.setHeader("refresh","3;url=index.jsp");
                             
                       %>

         <form action="<c:url value='/userLogin.do'/>">
         <input type="submit" value="跳转">
         </form>
         </body>
</html>