<%@ page language="java" import="java.util.*;" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'reg.jsp' starting page</title>
<%@ include file="/commons/meta.jsp"%>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<script type="text/javascript">
function checkUserName() {
var uName=document.myform.userName.value;
if (uName=="") {
alert("用户名不能为空");
return false;
}
}
function checkPwd() {
var pwd=document.myform.password.value;
if (pwd=="") {
alert("密码不能为空");
return false;
}
}
function checkPQ() {
var pwdQuestion=document.myform.passQuestion.value;
if (pwdQuestion=="") {
alert("密码提示问题不能为空");
return false;
}
}
function checkPassAnswer() {
var pA=document.myform.passAnswer.value;
if (pA=="") {
alert("答案不能为空");
return false;
}
}
function checkEmail(){
var strEmail=document.myform.email.value;
if (strEmail.length==0) {
alert("电子邮件不能为空!");
return false;
}
if (strEmail.indexOf("@",0)==-1) {
alert("电子邮件格式不正确\n必须包含@符号!");
document.myform.email.focus();
document.myform.email.select();
return false;
}
}
if (strEmail.indexOf(".",0)==-1) {
alert("电子邮件格式不正确\n必须包含.符号!");
document.myform.email.focus();
document.myform.email.select();
return false;
}
return true;
}
function clearText() {
if (document.myform.email.value=="请输入真实的电子邮件") {
document.myform.email.value="";
document.myform.email.style.color="red";
}
}
function checkTel() {
var tel=document.myform.telNo.value;
if (tel=="") {
alert("电话不能为空");
return false;
}
}
function checkAll() {
if (checkUserName()&&checkPwd()&&checkPQ()&&checkPassAnswer()&&checkTel()
return true;
else
return false;
}
</script>
<STYLE type="text/css">
.textBorder {
border: 1px; solid;
font-size: 15px;
}
</STYLE>
<body>
<div align="center">
<form action="../users.do" method="post" name="myform"
onsubmit="return checkEmail()">
<input type="hidden" name="method" value="register" />
<table width="400" border="1">
<tbody>
<tr>
<td>
用户名:
</td>
<td>
<input type="text" name="userName" id="userName">
<a > *</a>
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="password" name="password" id="password" />
<a > *</a>
</td>
</tr>
<tr>
<td>
再次输入密码:
</td>
<td>
<input type="password" name="password" id="password" />
<a > *</a>
</td>
</tr>
<tr>
<td>
性别:
</td>
<td>
<div>
<input type="radio" name="gender" value="男">
男
<input type="radio" name="gender" value="女">
女
<a > *</a>
</div>
</td>
</tr>
<tr>
<td>
密码提示问题:
</td>
<td>
<input type="text" name="passQuestion" id="passQuestion">
<a > *</a>
</td>
</tr>
<tr>
<td>
答案:
</td>
<td>
<input type="text" name="passAnswer" id="passAnswer">
<a > *</a>
</td>
</tr>
<tr>
<td>
电子邮件:
</td>
<td>
<input type="text" name="email" id="email" value="请输入真实的电子邮件"
onfocus="checkText()" >
<a > *</a>
</td>
</tr>
<tr>
<td>
电话:
</td>
<td>
<input type="text" name="telNo" id="telNo">
<a > *</a>
</td>
</tr>
<tr>
<td>
地址:
</td>
<td>
<input type="text" name="address" id="address">
</td>
</tr>
<tr>
<td>
身份证:
</td>
<td>
<input type="text" name="IDCardNo" id="IDCardNo">
</td>
</tr>
<tr>
<td>
<input type="submit" value="提交">
</td>
<td>
<input type="reset" value="重置">
</td>
</tr>
</tbody>
</table>
</form>
</div>
</body>
</html>