<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<script language= "JavaScript Tutorial" >
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>x user name cannot be empty!" </font> "
Return
}
if ((u_name.length<3) | | (u_name.length>12))
{
usercheck.innerhtml = "<font color=red>x username is 3 to 12 characters!</font>"
Return
}
if (Checkifenglish (u_name) ==false) {
usercheck.innerhtml = "<font color=red>x username can only be alphanumeric and underline!</font>";
Return
}
var datatosend = "U_name=" +u_name;
var xmlhttp = createxmlhttp ();
Xmlhttp.open ("Post", "Usercheck.asp Tutorial", 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>√ username" +u_name+ "has not been registered and can be used!" </font> "
}
else if ("2002" ==STRR)
{
usercheck.innerhtml = "<font color=red>x user name" +u_name+ "has been registered, please change username!" </font> "
}
}
</script>
<body>
<form id= "Form1" Name= "RegForm" method= "POST" action= "" >
<label>
Enter Password:
<input type= "type" name= "U_name" onblur= "checkuser (this);"/>
<div id= "Usercheck" ></div>
</label>
<label>
<input type= "Submit" name= "Submit" value= "Validation" onclick= "Checkpass ();" />
</label>
</form>
</body>