javascript加载xml,在chrome下失败的解决办法原来的写法:?this.loadxml function(xml) {var xmlDocif (
javascript加载xml,在chrome下失败的解决办法
原来的写法:
?
this.loadxml = function(xml) { var xmlDoc; if (window.ActiveXObject) { xmlDoc = new ActiveXObject('Microsoft.XMLDOM'); xmlDoc.async = false; xmlDoc.load(xml); } else if (document.implementation && document.implementation.createDocument) { try{ xmlDoc = document.implementation.createDocument('', '', null); xmlDoc.async = false; xmlDoc.load(xml); } catch(e){ var xmlhttp = new window.XMLHttpRequest(); xmlhttp.open("GET",xml,false); xmlhttp.send(null); xmlDoc = xmlhttp.responseXML.documentElement; } } else { return null; } return xmlDoc;};?
1 楼 enemy_99 2011-12-27 如果xml是个Document对象呢?