单击按钮,无反应
G_B 2006-08-03 09:25:29 情况如下:
运行 ajax基础教程 上面的例子,出现单击按钮无反应的情况,使用的浏览器 IE6。0,FIREFOX 1。5。0。6.
在另外一台电脑上面运行,结果一样。单击无反应。
代码清单 simpleRequest.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple XMLHttpRequest</title>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "simpleResponse.xml", true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
alert("The server replied with: " + xmlHttp.responseText);
}
}
}
</script>
</head>
<body>
<form action="#">
<input type="button" value="Start Basic Asynchronous Request" onclick="startRequest();"/>
</form>
</body>
</html>
服务器端的响应文件simpleResponse.xml就只用一行文本
Hello from the server!
有时间的话麻烦提点建议或者告诉如何解决,谢谢!!!
qq:285230769
mail:wen.285230769@gmail.com