
加载中…
个人资料
- 博客访问:
- 关注人气:
- 获赠金笔:0支
- 赠出金笔:0支
- 荣誉徽章:
jsp实现页面自动跳转代码总结
(2010-06-01 00:03:37)
1.<script language=javascript>
function out(obj){
var i = obj ;
if(i==0)
document.location.href="othorpage";
document.body.innerHTML = i;
i--;
setTimeout("out("+i+")",1000);
}
</script>
<body onload="out(5);">
</body>
2.
<%response.setHeader("Refresh","5;URL=...");%>
3.
<META HTTP-EQUIV="REFRESH" CONTENT="2";url=xxxx.jsp">
4.
jsp实现页面自动跳转
对于网站的用户注册模块考虑如下:当用户注册成功以后,把注册信息显示给用户,然后从这个页面自动跳转到登录页面,要求在指定时间之内,并且,用户可以看到倒计时的显示效果,具体控制实现的方法如下:<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><%
String url = basePath+"login.jsp";
%><html>
<head> <meta http-equiv=refresh content=5;url=<%=url %>> <script>
<!--
window.moveTo(0,0);
//-->
</script> </head>
<body > <b style=color:blue><span id=jump>5</span> 秒钟后页面将自动返回登录页面...</b> </body>
</html> <script>
function countDown(secs){
jump.innerText=secs;