var xmlHttp = false; 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(); } |
function callServer() { var u_name = document.getElementById("u_name").value; if ((u_name == null) || (u_name == "")) return; var url = "cu.asp?name=" + escape(u_name); xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = updatePage; xmlHttp.send(null); } |
!--cu.asp的源碼示例--> !--#include file="conn.asp"--> % name=request.querystring("name") Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select * from u_ser where u_name='"name"'" rs.Open sql,conn,1,1 if rs.eof and rs.bof then response.write("true") else response.write("false") end if rs.close set rs=nothing call CloseDatabase %> |
function updatePage() { if (xmlHttp.readyState 4) { test1.innerHTML="loading..."; } if (xmlHttp.readyState == 4) { var response = xmlHttp.responseText; test1.innerHTML=response; } } |
標(biāo)簽:深圳 伊春 西藏 撫州 威海 晉城 銅川 崇左
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《AJAX應(yīng)用之注冊(cè)用戶即時(shí)檢測(cè)》,本文關(guān)鍵詞 AJAX,應(yīng),用之,注冊(cè),用戶,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。