案例:XML案例     状态:可编辑再运行    进入横版
x
xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
 
1
<html>
2
3
<body>
4
<h1>W3xue.com Internal Note</h1>
5
<p>
6
<b>To:</b> <span id="to"></span><br />
7
<b>From:</b> <span id="from"></span><br />
8
<b>Message:</b> <span id="message"></span>
9
</p>
10
11
<script type="text/javascript">
12
if (window.XMLHttpRequest)
13
  {// code for IE7+, Firefox, Chrome, Opera, Safari
14
  xmlhttp=new XMLHttpRequest();
15
  }
16
else
17
  {// code for IE6, IE5
18
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
19
  }
20
xmlhttp.open("GET","/example/xmle/note.xml",false);
21
xmlhttp.send();
22
xmlDoc=xmlhttp.responseXML;
23
24
document.getElementById("to").innerHTML=

 运行结果 
 北美留学生论坛