Javascript 警报箱在哪里?
在下面的代码中,我得到了一个警报框,但正如您在代码中看到的,没有使用警报。那么它是从哪里来的Javascript 警报箱在哪里?,javascript,ajax,Javascript,Ajax,在下面的代码中,我得到了一个警报框,但正如您在代码中看到的,没有使用警报。那么它是从哪里来的 var mypostrequest=new ajaxRequest(); mypostrequest.onreadystatechange=function(){ if (mypostrequest.readyState==4){ if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){
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;
}
}
它显示的警报为“真”。
这是ajaxRequest()
函数ajaxRequest(){
var activexmodes=[“Msxml2.XMLHTTP”,“Microsoft.XMLHTTP”];//要在IE中检查的activeX版本
if(window.ActiveXObject){//首先测试IE中对ActiveXObject的支持(因为IE7中的XMLHttpRequest被破坏)
对于(var i=0;iNot在此代码中?显示ajaxRequest
的代码。仅此代码…仅回显true或false,@epoch,尝试删除所有警报,但我仍然以警报的形式获得true。您确定缓存已清除吗?是的,已完成所有操作,重新启动我的笔记本电脑。。
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;