[Android] UC浏览器不支持js+xml,该怎么解决
functiongetXmlList(xmlUrl){varxmlDoc;//codeforIEif(window.ActiveXObject){xmlDoc=newAc...
function getXmlList(xmlUrl) { var xmlDoc; // code for IE if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc = document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } xmlDoc.async = false; xmlDoc.load(xmlUrl); return(xmlDoc); } function htmlTitleSet() { var webTitle,xml; var url = "xml/common.xml"; xml = getXmlList(url); webTitle = xml.getElementsByTagName("zh")[0].childNodes[0].nodeValue; return webTitle; } document.writeln(htmlTitleSet());
展开
1个回答
展开全部
function getSource() { var url = " http://192.168.1.118/xml.xml"; //获取目标地址信息 if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); //FireFox、Opera等浏览器支持的创建方式 } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE浏览器支持的创建方式 } //创建XMLHttpRequest对象 xmlHttp.open("GET", url, false); xmlHttp.send(null); writeSource = xmlHttp.responseText; document.write(writeSource); }
希望采纳
希望采纳
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询