提示xmlhttp为空或不是对象,请帮个忙,谢谢
提示xmlhttp为空或不是对象,请帮个忙,谢谢
<script language="javascript" type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
var xmlhttp = createXMLHttpRequest();
function sendReq()
{
var uname=document.form1.username.value;
xmlhttp.open("get","lx2.jsp?username="+uname);
xmlhttp.onreadystatechange=handleChange;
xmlhttp.send(null);
}
</script>
<form id="form1" name="form1" method="post" action="">
<input type="text" name="username" onblur="sendReq()" />
</form>