日期:2014-05-17  浏览次数:21075 次

自己在实验一个ajax的小程序时,为什么点击就是没反应呢?
客户端index.html内容如下:
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
 {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
  document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  }
  }
xmlhttp.open("GET","info.asp",true);
xmlhttp.send();
}
</script>
</head>
<body>
<h2>AJAX</h2>
<button type="button" onclick="loadXMLDoc()">请求数据</button>
<div id="myDiv"></div>
</body>
</html>
服务器info.aso中内容如下:
<body>
<%
Response.Charset = "GB2312" 
Response.write("zhaoli")
%>
</body>
各位高手麻烦指点一下。

------解决方案--------------------
经我测验,是可以正常运行的。
你把你的程序用记事本打开,用ANSI模式重新保存一下再试试。
------解决方案--------------------
info.aso是不是info.asp

我看是因为你的index.html和info.asp不在同一目录下
------解决方案--------------------
试了一下,没问题,可以正常运行
------解决方案--------------------
缓存清除了没,试试看。