案例:XML案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
<script>
5
if (window.XMLHttpRequest)
6
  {// code for IE7+, Firefox, Chrome, Opera, Safari
7
  xmlhttp=new XMLHttpRequest();
8
  }
9
else
10
  {// code for IE6, IE5
11
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
12
  }
13
xmlhttp.open("GET","/example/xdom/books.xml",false);
14
xmlhttp.send();
15
xmlDoc=xmlhttp.responseXML; 
16
17
txt=xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
18
document.write(txt);
19
</script>
20
</body>
21
</html>