读书人

Ajax测试页面存在c00ce514异常附代码

发布时间: 2013-03-26 09:54:34 作者: rapoo

Ajax测试页面存在c00ce514错误,附代码
index.asp:


<html>

<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<script>
function Post(Url, Args)
{
var shows=Args;
xmlhttp = new window.XMLHttpRequest();
if(null != xmlhttp)
{
xmlhttp.open("GET", Url, true);
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("showText").value=xmlhttp.responseText;
}
}
xmlhttp.send();
}
}
</script>
</head>

<body>
<hi><%=Now%></hi>
<textarea id="showText" cols="50" rows="20">
</textarea>
<script>
Post("new.asp","");
</script>
</body>

</html>


new.asp

<%@LANGUAGE="VBSCRIPT"%>
<%
Response.Write("hello world")
%>


访问index.asp,使用IE8开发人员工具,发现出现“c00ce514”错误。
[解决办法]
改下
xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP')
[解决办法]
<%@LANGUAGE="VBSCRIPT"%>
没有写过ASP,不知道是不是上面这个问题。

我试了下你写的,JS没有问题。
[解决办法]
据说是编码的问题。。

<%@LANGUAGE="VBSCRIPT"%>
<%
Response.charset="gb2312"'''加这句试试
Response.Write("hello world")
%>


同时检查index.asp和new.asp的存储编码是否为ansi,记事本打开文件件,另存为,看编码是否为ansi,不是修改为ansi


觉得还是你浏览器有问题,即使编码不统一,最多乱码而已。。

读书人网 >Ajax

热点推荐