使用节点列表中的下标号来访问节点

  1. <html>
  2. <head>
  3. <script type="text/javascript" src="/example/xdom/loadxmldoc.js"></script>
  4. </head>
  5. <body>
  6.  
  7. <script type="text/javascript">
  8.  
  9. xmlDoc=loadXMLDoc("/example/xdom/books.xml");
  10. x=xmlDoc.getElementsByTagName("title");
  11. document.write(x[2].childNodes[0].nodeValue);
  12.  
  13. </script>
  14. </body>
  15. </html>