案例:XML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/example/xdom/loadxmldoc.js"></script>
4
</head>
5
<body>
6
<script type="text/javascript">
7
xmlDoc=loadXMLDoc("/example/xdom/books.xml");
8
9
document.write(xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue);
10
document.write("<br />");
11
document.write(xmlDoc.getElementsByTagName("author")[0].childNodes[0].nodeValue);
12
document.write("<br />");
13
document.write(xmlDoc.getElementsByTagName("year")[0].childNodes[0].nodeValue);
14
</script>
15
</body>
16
</html>
17