是你的ASP有问题,和AJAX没关系, 虽然你的AJAX不兼容DOM
当我把1.asp改成
<%
response.expires=-1
response.write("123")
%>
输入内容 时间的文本框中显示
<%
response.expires=-1
response.write("123")
%> 这么说好象你的ASP环境有问题吧,ASP没有解析
另, responseText读出的是请求页的所有源代码,不是浏览器内所看到的内容,比如下面的html代码,浏览器里看到的是"中华人民共和国",但如果用ajax请求, document.write(ajax.responseText)则是:
<html><body>中华人民共和国</body></html>
<html>
<body>
中华人民共和国
</body>
</html>
当我把1.asp改成
<%
response.expires=-1
response.write("123")
%>
输入内容 时间的文本框中显示
<%
response.expires=-1
response.write("123")
%> 这么说好象你的ASP环境有问题吧,ASP没有解析
另, responseText读出的是请求页的所有源代码,不是浏览器内所看到的内容,比如下面的html代码,浏览器里看到的是"中华人民共和国",但如果用ajax请求, document.write(ajax.responseText)则是:
<html><body>中华人民共和国</body></html>
<html>
<body>
中华人民共和国
</body>
</html>
谢谢!~
我把所有的选项勾上就好了
可是还是有点疑问
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<%
response.expires=-1
response.write("123")
%>
</body>
</html>为什么这么写就不对了??
这么写是绝对正确的
<%
response.expires=-1
response.write("123")
%>
{
document.form1.a.value=xmlhttp.responseText
}
} 这里少个判断
f(xmlhttp.readyState==4)
{
if(xmlHttp.status == 200){
document.form1.a.value=xmlhttp.responseText;
}
}
} 我大概写了个参考下:
<script type="text/javascript">
function getXmlHttp(){
if(window.XMLHttpRequest)
return new XMLHttpRequest();
else if(window.ActiveXObject)
return new ActiveXObject('microsoft.XMLHTTP');
else
return null;
} var xmlHttp = getXmlHttp();
if(xmlHttp){
var url = 'myData.asp';
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
alert(xmlHttp.responseText);
}
}
}
xmlHttp.send(null);
}
</script>另你可以直接访问下有问题的那个页面(直接在地址栏敲网址访问), 看是否正常...
因为我是直接打开1.html的 没有经过iis解析
后来我是用iis打开 就好了
唉 - -! 结帖了 !