详解php+ajax开发的注意事项(3)_PHP教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
推荐:解析用PHP操作MySql数据库?php /* *mysql数据库分页类 *@packagepagelist *@authoryytcpt(无影) *@version2008-03-27 *@copyrigthhttp://www.d5s.cn/ */ /* *分页样式 .page{float:left;font:11pxArial,Helvetica,sans-serif;padding:6px0;margin:0px10%;margin-top:10px;} .pagea,.pa
function sendRequest(strurl) {
httpRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!httpRequest) {
window.alert("通讯失败");
return false;
}
httpRequest.onreadystatechange = processRequest;
httpRequest.open("GET", strurl, true);
httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
httpRequest.send(null);
}>}
function asychronouscheck(strparam){
if(strparam.value.length == 0){
document.getElementById("state3").innerHTML="新帐号不能为空";
}
var strurl="checknewaccount.php?name="+encodeURIComponent(strparam.value);
sendRequest(strurl);
<BR pre="">
function asychronouscheck(strparam){
if(strparam.value.length == 0){
document.getElementById("state3").innerHTML="新帐号不能为空";
}
var strurl="checknewaccount.php?name="+encodeURIComponent(strparam.value);
sendRequest(strurl);
表单部分
<dl>
<dt>新帐号</dt>
<dd><label id="state3"></label></dd>
<dd><input type="text" name="nusername" id="nusername" size="26" maxlength="14" onblur="asychronouscheck(this)" /></dd>
</dl>
<dl>
<dt>新帐号</dt>
<dd><label id="state3"></label></dd>
<dd><input type="text" name="nusername" id="nusername" size="26" maxlength="14" onblur="asychronouscheck(this)" /></dd>
</dl>
分享:解析用PHP操作MySql数据库(DB类)?php /* *mysql数据库DB类 *@packagedb *@authoryytcpt(无影) *@version2008-03-27 *@copyrigthhttp://www.d5s.cn/ */ classdb{ varconnection_id=; varpconnect=0; varshutdown_queries=array(); varqueries=array(); varquery_id=; varquery_count=0; v
相关PHP教程:
- 相关链接:
- 教程说明:
PHP教程-详解php+ajax开发的注意事项(3)。