Internet explorer not showing <option> value on chain select

陌路散爱 提交于 2019-12-12 05:47:39

问题


I've gone through and seen all the answers on IE and issues, but I believe mine is unique. If not, Sorry.

Im busy building a Vehicle listing website for a friend, and I've had some help from a freelancer who is nowhere to be found now.

IE is not showing my model range when I select a vehicle make on my site.

This is the website View it here!

FF and all other browsers work prefectly. I'll also share some code if needed. Thanks. But Im sure you can see the issue through source code viewer.

Thanks


回答1:


It is a known bug for ie as IE don't support innerHTML property in case of select menus.

So,follow this link http://support.microsoft.com/kb/276228

Try this way instead of innerHTML use outerHTML only you have to also echo <select> tag in getodels.php and also this code is smarter and shorter than yours

function makeModel(str, change)
{var xmlhttp;
    if (str!="")
    {
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            var model = document.getElementById("model");
            model.outerHTML=xmlhttp.responseText;
            if(change) {
            }
        }
    }
    xmlhttp.open("GET","getmodels.php?make="+str,true);
    xmlhttp.send();
    }
}



回答2:


At first glance, it looks like a javascript problem, potentially AJAX related.

Try adding the following if your other IE ajax declaration fails. I have this listed for IE8+ in my projects.

xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");


来源:https://stackoverflow.com/questions/11062269/internet-explorer-not-showing-option-value-on-chain-select

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!