Ajax兼容性基础问题
JScript code:
var xmlHttp;
function creatReq() // 创建xmlhttprequest,ajax开始
{
if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
}
}
function Work()
{
creatReq();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange = callback;
xmlHttp.send();
}
function callback()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.Status==200)
{
Dispaly();
alert("服务端返回状态" + xmlHttp.Status);
}
else
{
alert("服务端返回状态" + xmlHttp.Status);
}
}
else //请求状态还没有成功,页面等待
{
document .getElementById ("main").innerHTML = "wait";
}
}
function Dispaly() //接受服务端返回的数据,对其进行显示
{
document .getElementById ("main").innerHTML =xmlHttp.responseText;
}
这样触发运行: <body onload="Work();">
问题在此:在IE6中没有问题,
在IE7中。xmlHttp.Status==出现的是undefined.xmlHttp.Status==OK.
如果
相关问答:
请哥哥姐姐弟弟妹妹叔叔阿姨们帮帮忙
我遇见了一个跟您一样的问题,就是我的 Visual Web Developer 2008 简体版 安装AJAX的时候也出现问题,我下载AjaxControlToolkit
了也解压了,但是没有安装AspAjaxExtSetu ......
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1&q ......
VBScript code:
Dim FoundErr,MsgErr
FoundErr = true
username=request.QueryString("userName")
password=request.QueryString("userPwd")
MsgErr = ""
if username = &qu ......
HuiFu.aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HuiFu.aspx.cs" Inherits="fdfdcs" %>
<!DOCTYPE html PUBLIC &q ......
JScript code:
function createRequest(){
if(window.XMLHttpRequest){
httpRequest=new XMLHttpRequest();
}else if(window.ActiveXObject){
try ......