Now let's take a look at the Check.js file code.
Function C () {
var uid =document.getelementbyid (' uid '). Value;
var pwd =document.getelementbyid (' password '). value;
var Pwd2=document.getelementbyid (' Password2 '). Value;
var mo =document.getelementbyid (' Mo '). Value;
var Name=document.getelementbyid (' name '). Value;
if (uid== ' | | uid.length>12 | | uid.length<3) {
document.getElementById (' U_info '). Innerhtml= ' <div id=error> nickname length is 3-12 characters!</div> ';
return false;
}else{
document.getElementById (' U_info '). innerhtml= ' <div class= ' defult ' > Username length 3-12-bit </div> ';
}
if (pwd = = ' | | pwd!=pwd2 | | pwd.length<6 | | pwd.length>12) {
document.getElementById (' P_info '). innerhtml= ' <div id=error> password cannot be null or two-input passwords inconsistent!</span> ';
return false;
}else{
document.getElementById (' P_info '). innerhtml= ' <div id=success></div> ';
document.getElementById (' P_info1 '). innerhtml= ' <div id=success></div> ';
}
if (Mo.match (/^[0-9]{3,4}-[0-9]{7,8}$/) | | | | mo.match (/^ ((d{3}) | d{3}-)) (13d{9}$/)) {
document.getElementById (' M_info '). innerhtml= ' <div id=success></div> ';
}else{
document.getElementById (' M_info '). Innerhtml= ' <div id=error> mobile phone 13875888888 with landline (0731-888888) </span> ';
return false;
}
if (name== ' | | name.length>12 | | name.length<2) {
document.getElementById (' N_info '). innerhtml= ' <div id=error> Please enter your real name!</span> ';
return false;
}else{
document.getElementById (' N_info '). innerhtml= ' <div id=success></div> ';
}
}
var xmlHttp = false;
function Ajaxcreate () {
try {
XmlHttp = new ActiveXObject ("Msxml2.xmlhttp");
catch (e) {
try {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
} catch (E2) {
XmlHttp = false;
}
}
if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {
XmlHttp = new XMLHttpRequest ();
}
if (!xmlhttp) {alert (' Create xmlHttp Fail '); return false;}
}
Function Ajax () {
ajaxcreate ();
var Xmvalue=document.getelementbyid ("UID"). Value
var url= "ajax_check.php?txt=" +encodeuri (Xmvalue);
if (xmvalue== null | | xmvalue.length>20 | | | xmvalue = = "") return false;
xmlhttp.open ("POST", url,true);
xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send (xmvalue);
xmlhttp.onreadystatechange=returnstate;
}
function Returnstate () {
if (xmlhttp.readystate!= 4) {
document.getelementbyid ("U_info"). innerHTML= "<div class=defult> is verifying please ...</div> later";
}
if (xmlhttp.readystate = = 4) {
document.getelementbyid ("U_info"). innerhtml= Xmlhttp.responsetext;
}
}