<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@ include file="../taglib/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
body {
line-height: 145%;
color: #333333;
text-decoration: none;
font-size: 12px;
}
</style>
<link href="style/style_club.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="dwr/util.js"></script>
<script type="text/javascript" src="dwr/engine.js"></script>
<script type="text/javascript" src="dwr/interface/validates.js"></script>
<script type="text/javascript">
var flag = true;
function endsub(){
// alert("hello"+flag);
return flag;
}
function checkpass(){
var pass = document.myform.pwd.value;
var divpass = document.getElementById("divpass");
if(pass.length == 0 || pass == ""){
divpass.innerHTML="密码不能为空!";
flag = false;
}else{
flag = true;
divpass.innerHTML="";
}
}
function validateuser(){
validates.validateUser(window.document.myform.name.value,callBack)//方法回调,把前面方法的返回值付给后面的方法名
}
function callBack(data){
var information = document.getElementById("info");
if(data=="false"){
document.getElementById("imagePic").src="/gradeManage/images/true.gif";
information.innerHTML = "该用户可以注册 !";
flag = true;
}else{
document.getElementById("imagePic").src="/gradeManage/images/false.gif";
information.innerHTML = "该用户已经存在 !";
flag = false;
}
}
function certain(){
var pwd = document.myform.pwd.value;
var repwd = document.myform.repwd.value;
var divrepass = document.getElementById("divrepass");
if(pwd != repwd){
divrepass.innerHTML="两次密码不一致 !";
flag = false;
}else{
flag = true;
divrepass.innerHTML="";
}
}
</script>
</head>
<body>
<center>
<h3>新用户注册</h3>
<form name="myform" action="user.do?method=add" method="post" οnsubmit="return endsub()">
<table>
<tr>
<th>用户名:</th>
<td><input name="name" type="text" size="22" οnblur="validateuser()"/><img src="/gradeManage/images/20.gif" name="imagePic"/></td>
</tr>
<tr>
<td> </td>
<td>
<div id=info style="color:red;padding:10px;font-size:12px;"></div>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<th>密码:</th>
<td><input name="pwd" type="password" size="24" οnblur="checkpass()"/></td>
</tr>
<tr>
<td> </td>
<td>
<div id=divpass style="color:red;padding:10px;font-size:12px;"></div>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<th>确认密码:</th>
<td><input name="repwd" type="password" size="24" οnblur="certain()"/></td>
</tr>
<tr>
<td> </td>
<td>
<div id=divrepass style="color:red;padding:10px;font-size:12px;"></div>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><input type="submit" value="注册"/></td>
<td><input type="reset" value="取消"/></td>
</tr>
<tr>
<td colspan="3"><font color="red">${requestScope.insert }</font></td>
</tr>
</table>
</form>
</center>
</body>
</html>
11-12