在下面的代码中,我收到了一个警告框,但正如您在代码中看到的那样,没有使用警报。所以来自哪里。
var mypostrequest=new ajaxRequest();
mypostrequest.onreadystatechange=function(){
if (mypostrequest.readyState==4){
if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){
if(mypostrequest.responseText == "true")
{
err.style.display = "none";
captcha.style.borderColor = "green";
document.validForm.submit();
return true;
} else{
captcha.style.borderColor = "red";
err.style.display = "inline-block";
err.innerHTML = "invalid captcha. Try again."
captcha.focus();
return false;
}
}
它显示的提醒是"true".
这是ajaxRequest()
function ajaxRequest(){
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE
if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
for (var i=0; i<activexmodes.length; i++){
try{
return new ActiveXObject(activexmodes[i]);
}
catch(e){
//suppress error
}
}
}
else if (window.XMLHttpRequest) // if Mozilla, Safari etc
return new XMLHttpRequest();
else
return false;
}