document.getElementById("DropDownList1")
解决方案 »
- jquery animate background-position不能做动画
- 50元求js高手解决个问题
- 如何实现在textarea选中项的前后插入[b]和[/b]标记?
- 可以用代码实现添加输入法吗?
- 为何用xmlhttp.onreadystatechange就不行?
- [讨论]prototype的成员叠加。。。。。
- 父子窗体都有frameset的,当子窗口让父窗口reload后,就再也不能访问父窗口了,怎么解决?
- 我收藏的一些精品文章,结集成册,供大家免费下载三天,过期不候,抓紧时间!!!
- 动态表格:删除一行
- jquery this用法 方法传参数 动态删除表格tr
- 用图片做的提交按钮怎么样按回车就提交?
- 求助:打印动态网页中,表格所检索出来的所有内容(包括未显示出的)
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];
}
上面的是兼容性处理代码