function loadXMLDoc(dname) { try{ //Internet Explorer xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } catch(e) { try{ //Firefox, Mozilla, Opera, etc. xmlDoc=document.implementation.createDocument("","",null); } catch(e) {alert(e.message)} } try { xmlDoc.async=false; xmlDoc.load(dname); return(xmlDoc); } catch(e) {alert(e.message)} return(null); } function loadXMLString(txt) { try{ //Internet Explorer xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(txt); return(xmlDoc); } catch(e) { try{ //Firefox, Mozilla, Opera, etc. parser=new DOMParser(); xmlDoc=parser.parseFromString(txt,"text/xml"); return(xmlDoc); } catch(e) {alert(e.message)} } return(null); }
Javascript XML
最新推荐文章于 2024-11-05 15:26:40 发布