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

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"