当前位置: 代码迷 >> JavaScript >> jsp学习札记(18)
  详细解决方案

jsp学习札记(18)

热度:220   发布时间:2012-12-21 12:03:49.0
jsp学习笔记(18)
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
	<html>
	<head>
	</head>
	<script language="JavaScript">
	<!--
		function Ok(){
		return true;//返回true模态窗口关闭;返回false模态窗口不关闭;
	}
	function check11(){	
 		if (document.form1.name.value == "" ) {
			alert("用户名不能为空!");
			document.form1.name.focus();
			 return false;
			}
		if (document.form1.pwd.value == ""  )  {
			alert("密码不能为空!");
			document.form1.pwd.focus();
			return false;
		}
		if (document.form1.qpwd.value == ""  ) {
			alert("确认密码不能为空!");
			document.form1.qpwd.focus();
			return false;
		}
		if (document.form1.qpwd.value != document.form1.pwd.value  ){
			alert("两次密码不一致!");
			document.form1.qpwd.focus();
			return false;
		}
		if (document.form1.zname.value == ""  ){
			alert("真实姓名不能为空!");
			document.form1.zname.focus();
			return false;
		}
		if (document.form1.age.value == ""  ) {
			alert("年龄不能为空!");
			document.form1.age.focus();
			return false;
		}
		if (document.form1.noid.value == ""  ){
			alert("身份证不能为空!");
			document.form1.noid.focus();
			return false;
		}
		if (document.form1.address.value == ""  ){
			alert("家庭住址不能为空!");
			document.form1.address.focus();
			return false;
		}
		if (document.form1.phone.value == ""  ){
			alert("电话号码不能为空!");
			document.form1.phone.focus();
			return false;
		}
		if (document.form1.email.value == ""  ){
			alert("电子邮箱不能为空!");
			document.form1.email.focus();
			return false;
		}
		if (document.form1.code.value == ""  ){
			alert("邮政编码不能为空!");
			document.form1.code.focus();
			return false;
		}
	}
	</script>
	<%
	String error = (String)request.getAttribute("error");
	if(error != null && error.equals("1")){
	%><script>alert('用户名重复!')</script><%
	}
	%>
	<body>
		<form action="/OnlineShop/servlet/RegServlet" name="form1" method="post" 	
		onSubmit="return check11()">
	<div align="center"><br>
	<table bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" border="1">
	<tr>
		<td colspan="3" align="center"bordercolorlight="#C0C0C0"bordercolordark=
		"#C0C0C0" height="25">
			<font color="#666666">请填写用户信息(为必填项)</font></td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">用 户 名:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="name"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>您用来登录的用户名
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">密&nbsp;&nbsp; &nbsp;码:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="password" name="pwd"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>长度必须大于5个小于16个字符,只能为英语字、数字
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">确认密码:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="password" name="qpwd"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请将输入的密码再次输入
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">真实姓名:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="zname"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>填写您的真实的姓名
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">性&nbsp; &nbsp;&nbsp;别:</font>
		</td>
		<td align="center" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" 
		height="25">
		<input type="radio" name="sex" checked value="男">男&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="radio" name="sex" value="女">女
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请填写您的真实信息
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">年&nbsp;&nbsp; &nbsp;龄:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="age"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请输入您的真实年龄
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">身份证号:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="noid"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请填写您的真实信息
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">家庭住址:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="address"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请填写您的真实信息
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">电话号码:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="phone"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请填写您的真实信息(格式为02411111111或                          		13911111111) </td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">电子邮箱:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="email"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">* </font>请填写您有效的邮件地址。
		</td>
	</tr>
	<tr>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="#996633">邮政编码:</font>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<input class="input7" type="text" name="code"/>
		</td>
		<td bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="25">
		<font color="red">&nbsp;* </font>请填写您的真实信息(格式为111111)</td>
	</tr>
	<tr>
		<td colspan="3" align="center" bordercolorlight="#C0C0C0"
		bordercolordark="#C0C0C0" height="25">
		<input type="submit" value="注册">
		</td>
	</tr>
	<tr>
		<%
			if(request.getAttribute("ok") != null){
		%>
		<th colspan="3" height="40" style="border: 2px groove #D5CD71" bgcolor=
		"#FCCE8F">
		<font size="3" color="red"> 恭喜您注册成功!!!!</font><br>
		</th>
		<%}%>
	</tr>
	</table>
	</div>
	</form>
	</body>
	</html>
	
  相关解决方案