显示节点列表的长度

  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. xmlDoc=loadXMLDoc("/example/xdom/books.xml");
  9.  
  10. x=xmlDoc.documentElement.childNodes;
  11. document.write("子节点的数目:" + x.length);
  12. </script>
  13. </body>
  14. </html>