<html xmlns="http://www.111cn.net/ 1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<script language="javascript教程">
function createxmlhttp()
{
var xmlhttp=null
try{
xmlhttp=new xmlhttprequest();
}
catch(e){
xmlhttp=new activexobject("microsoft.xmlhttp");
}
return(xmlhttp);
}function checkuser(u_name){
if(""==u_name)
{
usercheck.innerhtml = "<font color=red>× 用户名不能为空!</font>"
return;
}
if((u_name.length<3)||(u_name.length>12))
{
usercheck.innerhtml = "<font color=red>× 用户名为3到12个字符!</font>"
return;
}if(checkifenglish(u_name)==false){
usercheck.innerhtml = "<font color=red>× 用户名只能是字母数字和下划线!</font>";
return;
}var datatosend = "u_name="+u_name;
var xmlhttp = createxmlhttp();
xmlhttp.open("post","usercheck.asp教程",false);
xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded");
xmlhttp.send(datatosend);
var strr=xmlhttp.responsetext;
if ("1000"==strr)
{
usercheck.innerhtml = "<font color=green>√ 用户名 "+u_name+" 未被注册,可以使用!</font>"
}
else if("2002"==strr)
{
usercheck.innerhtml = "<font color=red>× 用户名 "+u_name+" 已被注册,请更换用户名!</font>"
}
}
</script>
</head>
<body>
<form id="form1" name="regform" method="post" action="">
<label>
输入密码:
<input type="type" name="u_name" onblur="checkuser(this);" />
<div id="usercheck"></div>
</label>
<label>
<input type="submit" name="submit" value="验证" onclick="checkpass();"/>
</label>
</form>
</body>
</html>