pass2936
等待验证会员
初级会员
UID 66486
精华
0
积分 64
帖子 44
金钱 64 喜悦币
威望 0
人脉 0
阅读权限 0
注册 2005-9-8
状态 离线
|
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
不理解
/*
Ajax 类
sUrl : 目标 URL
sQueryString : 提交变量
callbackFunc : 回调函数
callbackParams : 回调函数参数
sRecvType : 返回值格式 ( 0: 文本, 1: XML );
*/
function Ajax ( sUrl, sQueryString, callbackFunc, callbackParams, sRecvType )
{
this.url = sUrl;
this.queryString = sQueryString != null ? sQueryString : '';
this.response; // 返回值
this.maxRetry = 3; // 最大重试次数
this.countRetry = 0; // 重试次数
//创建xmlHttp对象
this.xmlHttp = this.createXMLHttpRequest ();
if ( this.xmlHttp == null )
{
return false;//此处做一些信息提示操作,以告知无法创建xmlHttp对象
}
//将创建的xmlHttp对象赋给objXml
var objxml = this.xmlHttp;
//定义回调函数
objxml.onreadystatechange = function ()
{
try
{
Ajax.handleStateChange ( objxml, sRecvType, callbackFunc, callbackParams )
}
catch ( e ) {}
}}
实在有些不明白,再次实例化一个obj,而为什么不直接这样写:
this.xmlHttp.onreadystatechange = function () {
Ajax.handleStateChange ( objxml, sRecvType, callbackFunc, callbackParams )
}
|
|