从第一个 <title> 元素获取文本
- <html>
- <head>
- <script type="text/javascript" src="/example/xdom/loadxmldoc.js">
- </script>
- </head>
- <body>
- <script type="text/javascript">
- xmlDoc=loadXMLDoc("/example/xdom/books.xml");
- x=xmlDoc.getElementsByTagName("title");
- txt=x[0].childNodes[0].nodeValue;
- document.write(txt);
- </script>
- </body>
- </html>