在最后一个子节点之后添加一个节点
- <html>
- <head>
- <script type="text/javascript" src="/example/xdom/loadxmldoc.js">
- </script>
- </head>
- <body>
- <script type="text/javascript">
- xmlDoc=loadXMLDoc("/example/xdom/books.xml");
- newel=xmlDoc.createElement("edition");
- x=xmlDoc.getElementsByTagName("book")[0];
- x.appendChild(newel);
- document.write(x.getElementsByTagName("edition")[0].nodeName);
- </script>
- </body>
- </html>