Firefox中无法响应ajax
时间:2011-04-19
来源:互联网
新手,用ajax比较少,附上代码,希望有朋友帮忙解释下
JScript code
在IE中测试通过,在FF中点击按钮触发ajaxSubmit()这个函数,变化的块就变成了UNDEFIND,哪位大侠教下为什么?
我只知道在创建的时候有兼容性,但是我已经加了。。。请问该如何改。在线等
JScript code
var xmlHttpReq; var xmlHttpReq1; //第一个交互,用来往表格传送 try { xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1) { try { xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e2) { try { xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP.3.0"); } catch(e3) { xmlHttpReq = false; } } } if (!xmlHttpReq && typeof XMLHttpRequest != 'undefined') { xmlHttpReq = new XMLHttpRequest(); } //第二个交互,用来往图片传送 //try { xmlHttpReq1 = new ActiveXObject("Msxml2.XMLHTTP"); } //catch(e1) { // try { xmlHttpReq1 = new ActiveXObject("Microsoft.XMLHTTP"); } // catch(e2) { try { xmlHttpReq1 = new ActiveXObject("MSXML2.XMLHTTP.3.0"); } // catch(e3) { xmlHttpReq1 = false; } } } // if (!xmlHttpReq1 && typeof XMLHttpRequest != 'undefined') { xmlHttpReq1 = new XMLHttpRequest(); } /////////////////////////////////////////////////创建XMLHttpRequest对象 END//////////////////////////////////////////////// function ajaxSubmit() { //计算日期大小 var start_time=document.getElementById("active_time_start").value; var end_time=document.getElementById("active_time_end").value; var aStart=start_time.split('-');//转成数组,分别为年月日 var aEnd=end_time.split('-'); var startDate = aStart[0]+"/" + aStart[1]+ "/" + aStart[2]; var endDate = aEnd[0] + "/" + aEnd[1] + "/" + aEnd[2]; if (startDate > endDate) { alert("开始日期必须小于结束日期"); return false; } //传送到表格页 var URL="NewUserTable.php?active_time_start="+start_time+"&active_time_end="+end_time+"&sid="+new Date().getTime(); xmlHttpReq.open('GET',URL,true); xmlHttpReq.onreadystatechange =updatePage; xmlHttpReq.send(); //传送到图片页 // var URL1="test1.php?active_time_start="+start_time+"&active_time_end="+end_time+"&sid="+new Date().getTime(); // xmlHttpReq1.open('GET',URL1,true); // xmlHttpReq1.onreadystatechange = updatePage; // xmlHttpReq1.send(); } function updatePage() { if (xmlHttpReq.readyState == 4) { document.getElementById("results").innerHTML=xmlHttpReq.responsetext; //if(xmlHttpReq1.readyState == 4){document.getElementById("a").innerHTML=xmlHttpReq1.responsetext;} } }
在IE中测试通过,在FF中点击按钮触发ajaxSubmit()这个函数,变化的块就变成了UNDEFIND,哪位大侠教下为什么?
我只知道在创建的时候有兼容性,但是我已经加了。。。请问该如何改。在线等
作者: hexiaomin1010 发布时间: 2011-04-19
responsetext没有区分带小写
JScript code
JScript code
//document.getElementById("results").innerHTML=xmlHttpReq.responsetext; document.getElementById("results").innerHTML=xmlHttpReq.responseText;
作者: showbo 发布时间: 2011-04-19
if (xmlHttpReq.readyState == 4) {
{
if(xmlHttpReq.status==200)
{}
}
{
if(xmlHttpReq.status==200)
{}
}
作者: net_lover 发布时间: 2011-04-19
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28