[Original]ajax implementation of user Registration function tutorial two ', '
//
This tutorial by the original site, reproduced please specify the place
Author: www.111cn.net
Email: drise@163.com
qq:271728967
//
The first reg.php file is done and I'm going to do the second step.
var xmlHttp = false;
function Ajaxcreate () {//Here is the creation of XMLHTTPT to like
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 () {//Here is the action to be performed after the reg.php onblur () event is received.
Ajaxcreate ();
var Xmvalue=document.getelementbyid ("XM"). Value;
var url= "/boke/blog/type.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 ("Divxm"). Innerhtml= "<div id=\\\ ' phperblog_showinfo_red\\\ ' ><font color=red> In the verification, please ...</font></div> later ";
}
if (xmlhttp.readystate = = 4) {
document.getElementById ("Divxm"). Innerhtml=xmlhttp.responsetext;
}
}