编辑下面的代码:【加编码】
<html> <body> <script> xmlDoc=document.implementation.createDocument("","",null); xmlDoc.async=false; xmlDoc.load("note_error.xml"); if (xmlDoc.documentElement.nodeName=="parsererror") { errStr=xmlDoc.documentElement.childNodes[0].nodeValue; errStr=errStr.replace(/</g, "&lt;"); document.write(errStr); } else { document.write("XML is valid"); } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂