主题:验证及页面跳转问题??
<%@ page language="java" contentType="text/html; charset=gb2312" %>
<html>
<head>
<title>注册信息</title>
</head>
<body >
<script language="javascript">
function yanzheng()
{
if(document.form1.uid.value=="")
{
alert("请输入学号!");
document.form1.uid.focus();
return false;
}
if(document.form1.nname.value=="")
{
alert("请输入用户名!");
document.form1.nname.focus();
return false;
}
if(document.form1.psw.value=="")
{
alert("请输入密码!");
document.form1.psw.focus();
return false;
}
if(document.form1.psw1.value="")
{
alert("请输入密码!");
document.form1.psw1.focus();
return false;
}
}
</script>
<%@ include file="head.html"%>
<table border="0" background="tian.jpg" width="1024" height="300">
<tr align="center">
<td><h1>注册信息</h1></td>
<tr align="center">
<td>
<form name="form1" method="post" action="conf.jsp">
学 号:<input type="text"name="uid">*<br><br>
用户名:<input type="text" name="nname">*<br><br>
性 别:<input type="radio"name="gender"value="1">男
<input type="radio"name="gender"value="2">女
<input type="radio"name="gender"value="3"checked>保密<br><br>
密 码:<input type="password" name="psw">*<br><br>
确认密码:<input type="password" name="psw1">*<br><br>
电话号码:<input type="text" name="photo"><br><br>
<input type="submit" name="button1" style="cursor: hand" value="提交" onclick="yanzheng()"></input>
<input type="reset" name="button2"value="重新填写"></input>
</form>
</td>
</table>
<%@ include file="foot.html"%>
</body>
</html>
提交后,如果不能通过验证则会提出出错信息,但是页面会马上跳转到conf.jsp中,怎样做才会使都通过了验证才跳转到conf.jsp页面??请大家多多提示啊!!
<html>
<head>
<title>注册信息</title>
</head>
<body >
<script language="javascript">
function yanzheng()
{
if(document.form1.uid.value=="")
{
alert("请输入学号!");
document.form1.uid.focus();
return false;
}
if(document.form1.nname.value=="")
{
alert("请输入用户名!");
document.form1.nname.focus();
return false;
}
if(document.form1.psw.value=="")
{
alert("请输入密码!");
document.form1.psw.focus();
return false;
}
if(document.form1.psw1.value="")
{
alert("请输入密码!");
document.form1.psw1.focus();
return false;
}
}
</script>
<%@ include file="head.html"%>
<table border="0" background="tian.jpg" width="1024" height="300">
<tr align="center">
<td><h1>注册信息</h1></td>
<tr align="center">
<td>
<form name="form1" method="post" action="conf.jsp">
学 号:<input type="text"name="uid">*<br><br>
用户名:<input type="text" name="nname">*<br><br>
性 别:<input type="radio"name="gender"value="1">男
<input type="radio"name="gender"value="2">女
<input type="radio"name="gender"value="3"checked>保密<br><br>
密 码:<input type="password" name="psw">*<br><br>
确认密码:<input type="password" name="psw1">*<br><br>
电话号码:<input type="text" name="photo"><br><br>
<input type="submit" name="button1" style="cursor: hand" value="提交" onclick="yanzheng()"></input>
<input type="reset" name="button2"value="重新填写"></input>
</form>
</td>
</table>
<%@ include file="foot.html"%>
</body>
</html>
提交后,如果不能通过验证则会提出出错信息,但是页面会马上跳转到conf.jsp中,怎样做才会使都通过了验证才跳转到conf.jsp页面??请大家多多提示啊!!