<!DOCTYPE html>
<body>
<script>
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","docu.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
{
// This is where my alert indicates that xmlDoc = null
// then nothing else happens below.
document.getElementById("stuff")=xmlDoc.getElementsByTagName("details")
[0].childNodes[0].nodeValue);
}
</script>
<input type="text" name="stuff" id="stuff"/>
</body>
</html>
以下是存储在根目录中的DOCU.XML
<?xml=version '1.0'?>
<root>
<details>xml data does not appear</details>
</root>