前端之家收集整理的这篇文章主要介绍了
AJAX 核心三部曲,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- 〈scriptlanuage=@H_404_6@"javaScript"〉
- functioncreateXMLHttpRequest(){
- if(window.ActiveXObject){
- xmlHttp=newActiveXObject(@H_404_6@"Microsoft.XMLHTTP");
- }
- elseif(window.XMLHttpRequest){
- xmlHttp=newXMLHttpRequest();
- }
- }
- functioncheckName(){
- createXMLHttpRequest();
- xmlHttp.onreadystatechange=handleStateChange;
- varsql=@H_404_6@"UserReg.aspx?";
- xmlHttp.open(@H_404_6@"GET",sql,true);
- xmlHttp.send(null);
- }
- functionhandleStateChange(){
- if(xmlHttp.readyState==4){
- if(xmlHttp.status==200){
- document.getElementById(@H_404_6@"divx").innerHTML=xmlHttp.responseText;
- }
- }
- }
- 〈script〉