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.
如果
相关问答:
http://localhost:8080/xx/zz.do 显示 out的 xml 数据
xml.open("GET",arguments[0],true);// arguments[0]是 /xx/zz.do
xml.send();
alert(arguments[0]);//这边有
x ......
先简单说明下,我要做的这个网站要开发用户综合社区,我们老板要的,象QQ那样的在线状态,并且即时接收消息,根据在线时长计算积分等等。我跟他说了这是网站,是Web应用程序,跟QQ那Windows应用程序不太一样,还要考 ......
<!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/xht ......
VBScript code:
Dim FoundErr,MsgErr
FoundErr = true
username=request.QueryString("userName")
password=request.QueryString("userPwd")
MsgErr = ""
if username = &qu ......
JScript code:
function createRequest(){
if(window.XMLHttpRequest){
httpRequest=new XMLHttpRequest();
}else if(window.ActiveXObject){
try ......