52,802
社区成员




<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>会员注册</title>
<script type="text/javascript">
function cheked(){
var txtname=document.insert.txtname.value.length;
if(txtname==0){
alert("用户名不能为空!");
return false;
}
}
var req;
function validate() {
var idField = document.getElementById("userid");
var url = "AjaxValidate.jsp?id=" + escape(idField.value);
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
function callback() {
if(req.readyState == 4) {
if(req.status == 200) {
//alert(req.responseText);
var msg = req.responseXML.getElementsByTagName("msg")[0];
//alert(msg);
setMsg(msg.childNodes[0].nodeValue);
}
}
}
function setMsg(msg) {
//alert(msg);
mdiv = document.getElementById("usermsg");
if(msg == "yes") {
mdiv.innerHTML = "<font style='font-size: 12px;' color='#FFFF00'>很遗憾,该帐号已经被注册,请您另选一个 </font>";
}else if(msg=="no"){
mdiv.innerHTML = "<font style='font-size: 12px;' color='#66FFFF'>恭喜,该用户名可以使用 </font>";
}
if(document.insert.txtname.value==""){
mdiv.innerHTML = "<font style='font-size: 12px;' color='#FFFF00'>注册帐号不能为空 </font>";
}
}
</script>
<style type="text/css">
<!--
body {
background-color: #22578B;
}
-->
</style>
</head>
<body>
<div align="center">
<div><%@include file="includ/cn_head.jsp" %></div>
<form name="insert" action="servlet/RegisterServlet.html" method="post" onSubmit="this.regsubmit.disabled=true;">
<ul style="list-style:none; width:70%">
<li style="margin:6px;font-size: 13px;color: #FFFFFF">* 用户名:<input type="text" name="txtname" style=" width:200px" onBlur="validate()" id="userid"><br><br><span id="usermsg"></span></li>
<li style="margin:6px;font-size: 13px;color: #FFFFFF">* 密 码:<input type="password" name="pwdname" style=" width:200px"></li>
<li style="margin:6px;font-size: 13px;color: #FFFFFF">* 昵 称:<input type="text" name="txtpet" style=" width:200px"></li>
<li style="margin:6px;font-size: 13px;color: #FFFFFF">* 电 话:<input type="text" name="txtOther" style=" width:200px"></li>
<li style="margin:6px;font-size: 13px;color: #FFFFFF">* 头 像:<input type="radio" name="head" value="1" /><img src="images/head/1.gif"></img>
<input type="radio" name="head" value="2" /><img src="images/head/2.gif"></img>
<input type="radio" name="head" value="3" /><img src="images/head/3.gif"></img>
<input type="radio" name="head" value="4" /><img src="images/head/4.gif"></img>
<input type="radio" name="head" value="5" /><img src="images/head/5.gif"></img>
<input type="radio" name="head" value="6" /><img src="images/head/6.gif"></img></li>
<script>
document.all.head[0].click();
</script>
<li style="margin:6px;font-size: 13px;color: #FFFFFF"> <input type="submit" name="regsubmit" value="注册" onclick="return cheked()">
<input type="reset" name="Submit2" value="重置"></li>
<li><img src="images/top-login.gif"/></li>
</ul>
</form>
<div><%@include file="includ/cn_foot.jsp" %></div>
</div>
</body>
</html>
function callback() {
if(req.readyState == 4) {
if(req.status == 200) {
//alert(req.responseText);
var msg = req.responseXML.getElementsByTagName("msg")[0];
//alert(msg);
setMsg(msg.childNodes[0].nodeValue);
// upon successful registration
if (msg.indexOf("已经被注册") == -1) {
document.getEl…