日期:2014-05-16  浏览次数:20427 次

火狐、谷歌、等浏览器不支持 xmlhttp.open("GET", "http://niceloo.com/Domain.xml", false)
JScript code


 <script language="javascript" type="text/javascript">
     function ShowDomain(isLink, id, setevent, setStyle) {
         if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
             xmlhttp = new XMLHttpRequest();
         }
         else {// code for IE6, IE5
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         }
         xmlhttp.open("GET", "http://niceloo.com/Domain.xml", false);
         xmlhttp.send();
         xmlDoc = xmlhttp.responseXML;
         var xmlDomin = xmlDoc.getElementsByTagName("DomainID");
         var strDomsel = "";
         if (isLink == true) {
             strDomsel += "<select id=\"" + id + "\" " + setevent + " " + setStyle + "> <option value=\"http://www.geedu.com\">全国分校</option>";
             for (var i = 0; i < xmlDomin.length; i++) {
                 strDomsel += " <option value=\"http://" + xmlDomin[i].getAttribute("ID") + ".geedu.com\">" + xmlDomin[i].childNodes[0].nodeValue + "分校</option>";
             }
         } else {
             strDomsel += "<select id=\"" + id + "\" " + setevent + " " + setStyle + ">";
             for (var i = 0; i < xmlDomin.length; i++) {
                 strDomsel += "<option value=\"" + xmlDomin[i].getAttribute("ID") + "\">" + xmlDomin[i].childNodes[0].nodeValue + "分校</option>";
             }
         }
         strDomsel += "</select>";
         return strDomsel;
     }
     window.onload = function () {
         var showdomid = document.getElementById("show1s");
         showdomid.innerHTML =ShowDomain(false, "changeSchoolShowAd", "onchange=\"showSchool(this.value);\"", "style=\"margin-top:40px;\""); ;

     }





火狐、谷歌等浏览器不支持跨域访问xml文件。有解决方案吗?谢谢了!

------解决方案--------------------
在服务器端得到再发送给客户端
------解决方案--------------------
用后台来抓取远程页面,然后传给前台。
------解决方案--------------------
跟站长说,让他给你一个接口

嘿嘿,MS这个更不靠谱。。。