使用 length 属性来循环节点
- <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");
- for (i=0;i<x.length;i++)
- {
- document.write(x[i].childNodes[0].nodeValue);
- document.write("<br />");
- }
- </script>
- </body>
- </html>
上一篇:使用节点列表中的下标号来访问节点
下一篇:循环元素节点