为什么在firefox中就不好使哪? document.getElementById("DropDownList1") 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 都改成了document.getElementById("DropDownList1")形式,还是不行啊 在firefox上,从服务器就无法返回了,不知道怎么回事 var XmlHttp; if(window.ActiveXObject){ XmlHttp=new ActiveXObject("Microsoft.XmlHttp"); }else if(window.XMLHttpRequest){ XmlHttp=new XMLHttpRequest(); //alert(XmlHttp); } function sendAJAX(par) { XmlHttp.open("POST","receive.aspx",true); XmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded'); XmlHttp.send(par); XmlHttp.onreadystatechange=ServerProcess; } function ServerProcess() { if (XmlHttp.readyState==4 || XmlHttp.status==200) { var obj = document.getElementById("DropDownList1"); obj.style.display=""; var s=XmlHttp.responseText; var al=s.split(";"); obj.options.length = 0; for(var i=0;i<al.length;i++) { obj.options[obj.options.length] = new Option(al[i],al[i]); } } } 微软软件基本都是默认不区分大小写。*nix下的软件默认大小写严格区分。 document.all是FF支持的原因肯定不在这里 XmlHttp=new ActiveXObject("Microsoft.XMLhttp");这个在FF下不能用的.用类似下面的方法创建xmlhttp,以适应不同的浏览器.function sajax_init_object(){ var A = null ; try { A=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { A=new ActiveXObject("Microsoft.XMLHTTP"); } catch (oc) { A=null; } } if(!A && typeof XMLHttpRequest != "undefined") A = new XMLHttpRequest(); return A;} function lib_bwcheck(){ //兼容性处理代码 this.ver=navigator.appVersion; this.agent=navigator.userAgent this.dom=document.getElementById?1:0 this.win = (navigator.appVersion.indexOf("Win")>0); this.xwin = (navigator.appVersion.indexOf("X11")>0); this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ie=this.ie4||this.ie5||this.ie6 this.mac=this.agent.indexOf("Mac")>-1 this.opera5=this.agent.indexOf("Opera 5")>-1 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom||false); this.width = null; this.height = null; return this}var bw = new lib_bwcheck();function getObjectById( ID ) { if (bw.ns6) return top.document.getElementById(ID); else if (bw.ns) return top.document.layers[ID]; else return top.document.all[ID]; } 上面的是兼容性处理代码 请问这个构造函数链为什么不成功啊 如何实现文本框第一次点全选,再点可以编辑。 同步ajax造成假死 ,怎么处理 求解释一个引用JS是什么东西 正则表达式new RegExp()与/patten/的困惑 includeJSP页面后,动态生成表格无法显示——急急急 急,在线等!一个回调函数非常纠结的问题.... 如何处理参数中的/呢? 请问怎样动态设置FRAMESET?多谢!!! JS不明语法 用图片做的提交按钮怎么样按回车就提交? 求助:打印动态网页中,表格所检索出来的所有内容(包括未显示出的)
if(window.ActiveXObject){
XmlHttp=new ActiveXObject("Microsoft.XmlHttp");
}else if(window.XMLHttpRequest){
XmlHttp=new XMLHttpRequest();
//alert(XmlHttp);
}
function sendAJAX(par)
{
XmlHttp.open("POST","receive.aspx",true);
XmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
XmlHttp.send(par);
XmlHttp.onreadystatechange=ServerProcess;
}
function ServerProcess()
{
if (XmlHttp.readyState==4 || XmlHttp.status==200)
{
var obj = document.getElementById("DropDownList1");
obj.style.display="";
var s=XmlHttp.responseText;
var al=s.split(";");
obj.options.length = 0;
for(var i=0;i<al.length;i++)
{
obj.options[obj.options.length] = new Option(al[i],al[i]);
}
}
}
原因肯定不在这里
这个在FF下不能用的.
用类似下面的方法创建xmlhttp,以适应不同的浏览器.
function sajax_init_object()
{
var A = null ;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
return A;
}
this.ver=navigator.appVersion;
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.win = (navigator.appVersion.indexOf("Win")>0);
this.xwin = (navigator.appVersion.indexOf("X11")>0);
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom||false);
this.width = null;
this.height = null;
return this
}var bw = new lib_bwcheck();function getObjectById( ID ) {
if (bw.ns6) return top.document.getElementById(ID);
else if (bw.ns) return top.document.layers[ID];
else return top.document.all[ID];
}
上面的是兼容性处理代码