获取元素的值

  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.  
  11. x=xmlDoc.getElementsByTagName("title")[0]
  12. y=x.childNodes[0];
  13. document.write(y.nodeValue);
  14.  
  15. </script>
  16. </body>
  17. </html>