<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>