编辑下面的代码:【加编码】
<html> <head> <script> var xmlDoc; function loadXML() { //load xml file code for IE if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("/demo/xml/note.xml"); displaymessage(); } // code for Mozilla, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc= document.implementation.createDocument("","",null); xmlDoc.load("note.xml"); xmlDoc.onload=displaymessage; } else { document.write("Your browser cannot handle this script"); } } function displaymessage() { document.write(xmlDoc.getElementsByTagName("body")[0].firstChild.nodeValue); } </script> </head> <body onload="loadXML()"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂