用PHP技术做一个检测用户名是否存在的按钮,能不能不跳转到后台页面直接在本页面和数据库连接进行判断??
来源:百度知道 编辑:UC知道 时间:2024/05/26 06:10:06
AJAX技术,和PHP没关系.
用ajax就行。上面 addgrrr就说得很正确。 实在不明白,就找我
用ajax,不刷新当前页面进行检测.
(1)script.js
var xmlHttp = false;
function CrXMLHttpRequest() {
xmlHttpObj = ["Microsoft.xmlHttp","MSXML2.xmlHttp.5.0","MSXML2.xmlHttp.4.0","MSXML2.xmlHttp.3.0","MSXML2.xmlHttp"];
if(window.XMLHttpRequest) { //Mozilla 浏览器
xmlHttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
for(i=0;i<xmlHttpObj.length;i++) {
xmlHttp = new ActiveXObject(xmlHttpObj[i]);
if(xmlHttp) {
break;
}
}
} else {
return false;
}
return xmlHttp?xmlHttp:false;
}
function sendAttruValue(value) {
var url = "checked.php?userSTR=" + value;
CrXMLHttpRequest();
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ReadyAttru;
xmlHttp.send(null);
}
function ReadyAttru() {
if (