Ajax用户名验证错误,求解。 - Web 开发 / Ajax
<script>
var http_request=false;
function createRequest(){
alert("不能创建对象实例");
-------------------------------------------------------------------------
http_request=false;
var url="/Web1/CheckUser?usrename="+form.username.value;
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType("text/xml");
}
}else if{
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
if(!http_request){
alert("不能创建对象实例");
return false;
}
http_request.onreadystatechange=getResult;
http_request.open('POST',url,true);
http_request.send();
-------------------------------------------------------------------
}
function getResult(){
if(http_request.readyState==4){
if(http_request.status==200){
answer.innerHTML=http_request.responseText;
}else{
alert("您请求的页面有错误");
}
}
}
</script>
<body>
<td height="18" colspan="2">
<div align="right" class="STYLE1">
用户名:
</div>
</td>
<td colspan="2">
<input name="username" type="text" id="username" size="19"
onblur="return createRequest();" />
<span class="STYLE6">*</span>
</td>
</body>去掉画线中间那里就能弹出提示框..加上以后就没反应了.....求解啊
------解决方案--------------------只有这一个文件?你那URL并没有设置成一个路径吧?
------解决方案--------------------else if{
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
if去掉