function checkUsername(){@H_502_1@
var username = document.getElementById("username").value;@H_502_1@
// 1.创建异步交互对象@H_502_1@
var xhr = createXmlHttp();@H_502_1@
// 2.设置监听@H_502_1@
xhr.onreadystatechange = function(){@H_502_1@
if(xhr.readyState == 4){@H_502_1@
if(xhr.status == 200){@H_502_1@
document.getElementById("span1").innerHTML = xhr.responseText;@H_502_1@
}@H_502_1@
}@H_502_1@
}@H_502_1@
// 3.打开连接(防止缓存)@H_502_1@
xhr.open("GET","${pageContext.request.contextPath}/user_findByName.action?time="+new Date().getTime()+"&username="+username,true);@H_502_1@
// 4.发送@H_502_1@
xhr.send(null);@H_502_1@
}@H_502_1@
//创建异步请求对象@H_502_1@
function createXmlHttp(){@H_502_1@
var xmlHttp;@H_502_1@
try{@H_502_1@
xmlHttp=new XMLHttpRequest();@H_502_1@
}@H_502_1@
catch (e){@H_502_1@
try{// Internet Explorer@H_502_1@
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");@H_502_1@
}@H_502_1@
catch (e){@H_502_1@
try{@H_502_1@
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");@H_502_1@
}@H_502_1@
catch (e){}@H_502_1@
}@H_502_1@
}@H_502_1@
@H_502_1@
return xmlHttp;@H_502_1@
}@H_502_1@