<html> <head> <script type="text/javascript" src="../dom/loadxmldoc.js"> </script> </head> <body> <script type="text/javascript"> xmlDoc=loadXMLDoc("/upload/file/xml/books_ns.xml"); var x=xmlDoc.getElementsByTagName('title'); for(i=0;i<x.length;i++) { document.write("Prefix: " + x.item(i).attributes[0].prefix); document.write("<br />"); document.write("Local name: " + x.item(i).attributes[0].localName); document.write("<br />"); document.write("Namespace URI: " + x.item(i).attributes[0].namespaceURI); document.write("<br />"); document.write("Base URI: " + x.item(i).attributes[0].baseURI); document.write("<br />"); document.write("<br />"); } </script> </body> </html>
编辑上面的文字,按下“查看结果”,效果会显示在右边 Create by 软晨网(RuanChen.com)