如何在用户注册成功之后,显示“你已经注册成功!”并使用“定时功能”跳转到登陆页面呢?
register.jsp
<%@page contentType= "text/html; charset=GB2312 "%>
<html>
<head>
<title> register </title>
</head>
<body bgcolor= "#ffffff ">
<p align= "center "> 新用户注册
<form name= "thisForm " action= "insert.jsp " method= "GET " accept-charset= "UTF-8 " onsubmit= "return formCheck() ">
<script language= "JavaScript " type= "text/JavaScript ">
function formCheck(){
number=new RegExp( "05[0-3][0-9] ");
if(thisForm.userID.value== " "){
alert( "请输入你的学号! ");
return false;
userID.focus();
}else{
if(thisForm.userID.value.match(number)==null){
alert( "格式输入错误,你必须输入这样的格式0538,前两位数字必须为05,后面两位必须从1--40 ");
userID.value= " ";
return false;
userID.focus();
}
}
if(thisForm.userName.value== " "){
alert( "请输入你的姓名! ");
return false;
userName.focus();
}
if(thisForm.password.value!=thisForm.pass.value){
alert( "两次输入的密码不一致,请再次输入! ");
password.value= " ";
pass.value= " ";
return false;
password.focus();
}
return true;
} </script>
<p align= "center ">
<table>
<tr>
<td align= "right "> 学号: </td>
<td>
<input type= "text " name= "userID "/>
</td>
</tr>
<tr>
<td align= "right "> 注册名: </td>
<td>
<input type= "text " name= "userName "/>
</td>
</tr>
<tr>
<td align= "right "> 密码: </td>
<td>
<input type= "password " name= "password "/>
</td>
</tr>
<tr>
<td align= "right "> 请再次输入密码: </td>
<td>
<input type= "password " name= "pass "/>
</td>
</tr>
<tr>
<td> <input type= "submit " name= "sub " value= "提交 "> </td>
<td> <input type= "reset " name= "res " value= "重写 ">
</tr>
</table>
</form>
</body>
</html>
登录文件是:login.jsp,如何在如何在用户注册成功之后,显示一条信息,如“你已经注册成功!”,并且在经过几秒后自动跳转到login.jsp页面呢?求教!
[解决办法]
用javascript 写 fun() , 在成功后调用fun() ,fun()函数实现现实“你已经注册成功!”,然后做一个延时操作,在到login.jsp。
[解决办法]
<script language= "javascript ">
function doReload()
{
location.href= "login.jsp ";
}
setTimeout( "doReload() ",3000);
//三秒钟后重定向到login.jsp
</script>
试一下应该可以!!
[解决办法]
setTimeout( "doRedirect() ",3000);//redirect to other page after 3 seconds
[解决办法]
<head>
<meta http-equiv= "refresh " content= "3;url=index.jsp ">
<head>
<body>
显示字样......
</body>
[解决办法]
<html>
<head>
<meta http-equiv= "refresh " content= "3;url=index.jsp ">
<script>
alert( '注册成功 ');
</script>
<head>
<body>
</body>
</html>
[解决办法]
<meta http-equiv= "refresh " content= "3;url=index.jsp "> 让网页自动刷新
[解决办法]
<%@ page language= "java " import= "java.util.* " pageEncoding= "GBK "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> My JSP '2.jsp ' starting page </title>
<script language= "javascript ">
var count = 5;//记数器
function countdown()
{
count--;
if(count == 1)
{
window.location.href= '3.jsp ';
}
if(document.layers)
{
document.layers.showtime.document.write(count);
document.layers.showtime.document.close();
}
else if(document.all)
{
showtime.innerHTML=count+ " 秒后自动返回 ... ";
}
setTimeout( "countdown() ",1000);
}
</script>
</head>
<body bgcolor= "#F4F6F6 " onLoad= "countdown(); ">
<center>
<span id= "showtime "> </span>
</center>
您已经注册成功
</body>
</html>
===============================================================================
你直接copy过去就可以用了
[解决办法]
楼上的是正解
[解决办法]
<meta http-equiv= "refresh " content= "3;url=index.jsp ">
正解!
[解决办法]
servlet里面response到不同的页(比如登陆成功或失败)
成功页加上 <meta http-equiv= "refresh " content= "3;url=index.jsp ">
url是你要跳转的页