w3c的例子有问题?
<html>
<body>
<script type="text/javascript">
xmlHttp=null;
if (window.XMLHttpRequest)
{// code for IE7, Firefox, Opera, etc.
xmlHttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE6, IE5
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlHttp!=null)
{
xmlHttp.open("GET", "advance.xml", false);
xmlHttp.send(null);
xmlDoc=xmlHttp.responseText;
alert(xmlDoc);
// xmlHttp.open("POST", "demo_dom_http.asp", false);
// xmlHttp.send(xmlDoc);
// document.write(xmlHttp.responseText);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
</script>
</body>
</html>
以上的例子是我在W3C上面复制下来的,值注释了3行。但是运行时提示xmlHttp.open("GET", "advance.xml", false);有错。
advance.xml这个文件也有。并且路径也是对的。