Ec (2); now let's check. js file code. functionc () {& nbsp; varuid & nbsp; document. getElementById (uid ). value; & nbsp; varpwd & nbsp; document. getElementById (password ). value; & nbsp; varpwd script ec (2); script
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 ('M'). value;
Var name = document. getElementById ('name'). value;
If (uid = ''| uid. length> 12 | uid. length <3 ){
Document. getElementById ('U _ info'). innerHTML ='
The length of the nickname is 3-12 characters!
';
Return false;
} Else {
Document. getElementById ('U _ info'). innerHTML ='
Username must be 3-12 characters long
';
}
If (pwd = ''| pwd! = Pwd2 | pwd. length <6 | pwd. length> 12 ){
Document. getElementById ('P _ info'). innerHTML ='
The password cannot be blank or the password entered twice is inconsistent! ';
Return false;
} Else {
Document. getElementById ('P _ info'). innerHTML ='
';
Document. getElementById ('P _ info1 '). innerHTML ='
';
}
If (mo. match (/^ [0-9] {3, 4}-[0-9] {7, 8} $/) | mo. match (/^ (d {3}) | (d {3 }-))? 13d {9 }$ /)){
Document. getElementById ('m _ info'). innerHTML ='
';
} Else {
Document. getElementById ('m _ info'). innerHTML ='
Phone 13875888888 and landline (0731-888888 )';
Return false;
}
If (name = ''| name. length> 12 | name. length <2 ){
Document. getElementById ('n' _ info'). innerHTML ='
Enter your real name! ';
Return false;
} Else {
Document. getElementById ('n' _ info'). innerHTML ='
';
}
}
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 ="
Verifying. Please wait...
";
}
If (xmlHttp. readyState = 4 ){
Document. getElementById ("u_info"). innerHTML = xmlHttp. responseText;
}
}