案例:XML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/example/xdom/loadxmldoc.js"> 
4
</script>
5
</head>
6
<body>
7
8
<script type="text/javascript">
9
xmlDoc=loadXMLDoc("/example/xdom/books_comment.xml");
10
11
x=xmlDoc.getElementsByTagName("book")[0].childNodes;
12
13
for (i=0;i<x.length;i++)
14
{ 
15
if (x[i].nodeType==8)
16
  { 
17
  //Process only comment nodes
18
  x[i].insertData(10,"Illustrated ");
19
  document.write(x[i].data);
20
  document.write("<br />");
21
  } 
22
}
23
</script>
24
</body>
25
</html>
26