0

我在http://worldcitiesdatabase.info/test1/有一个 js/ajax 脚本

我刚刚收到投诉说它在 IE8 中无法正常工作。

Onchange 似乎工作,但随后没有填充下一个菜单。

你能帮我弄清楚吗?

谢谢

不确定代码的问题部分是什么。这是我的猜测:

if (window.XMLHttpRequest) {//  code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            } else {//                      code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            newList="";
            xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                    newList = xmlhttp.responseText;
                    m1.innerHTML=newList;
                    m1.disabled=false;
                }
                if (menuname=="showCountry")  {
                    var c1=document.getElementById('showRegion');
                    if (c1.options.length==2) {
                        if (c1.options[0].value=='NONE') {
                            c1.remove(0);
                            c1.value='0';
                            reloadmenu(c1);
                        }
                    }
                }
            }
            xmlhttp.open("GET",newFile+".php?q="+menuvalue,true);
            xmlhttp.send();
4

1 回答 1

2

线

m1.innerHTML=newList;

是罪魁祸首,因为您使用innerHTML<option>s 添加到<select>. 这是 IE8 中的一个已知错误 - http://support.microsoft.com/kb/276228

注意:如果您只打开开发人员工具并在 IE8 模式下运行它,您可以在 Internet Explorer 中运行您的测试页面(参见例如http://techathlon.com/internet-explorer-10-run-compatibility-mode/

于 2013-11-10T21:42:19.317 回答