var net=new Object(); //定义一个全局变量net
//编写构造函数
net.AjaxRequest=function(url,onload,onerror,method,params){
  this.req=null;
  this.onload=onload;
  this.onerror=(onerror) ? onerror : this.defaultError;
  this.loadDate(url,method,params);
}
//编写用于初始化XMLHttpRequest对象并指定处理函数,最后发送HTTP请求的方法
net.AjaxRequest.prototype.loadDate=function(url,method,params){
  if (!method){ //设置默认为的请求方式为GET
    method="GET";
  }
  if (window.XMLHttpRequest){ // Mozilla……等非IE浏览器
    this.req=new XMLHttpRequest();  //创建XMLHttpRequest对象
  } else if (window.ActiveXObject){ //IE浏览器
try{
this.req=new ActiveXObject("Msxml2.XMLHTTP");  //创建XMLHttpRequest对象
}catch(e){
try{
this.req=new ActiveXObject("Microsoft.XMLHTTP");  //创建XMLHttpRequest对象
}catch(e){}
}
  }
  if (this.req){
    try{
      var loader=this;
      //指定回调函数
      this.req.onreadystatechange=function(){
        net.AjaxRequest.onReadyState.call(loader);
      }
      this.req.open(method,url,true); //创建与服务器的连接
  if(method=="POST"){ //当发送POST请求时,设置请求头
this.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
  }
      this.req.send(params); //向服务器发送请求
    }catch (err){
      this.onerror.call(this); //调用错误处理函数
    }
  }
}//重构回调函数
net.AjaxRequest.onReadyState=function(){
  var req=this.req;
  var ready=req.readyState; //获取请求状态
  if (ready==4){
    if (req.status==200 ){
      this.onload.call(this); //调用回调函数
    }else{
      this.onerror.call(this); //调用错误处理函数
    }
  }
}
//重构默认的错误处理函数
net.AjaxRequest.prototype.defaultError=function(){
  alert("错误数据\n\n回调状态:"+this.req.readyState+"\n状态: "+this.req.status);
}
这是在《JAVA WEB开发实战宝典》中的“ajax重构”这一章看到的一段js程序,基本没怎么看懂。类似这种语句:var loader=this和net.AjaxRequest.prototype.loadDate=function(url,method,params)有点搞不明白,prototype属性不是应用在对象上面的吗(比如:对象.prototype属性=某个方法)?怎么给net对象的AjaxRequest方法加上一个prototype属性呢?还有就是被if判断语句部分中的:if(this。req)、if(!method)这些括号里边的东西搞得一头雾水、另外,对call()函数基本也就是了解个语法恳请结合本例解释解释,最后就是js里边的this看到小弟好纠结...最好就是能逐行指教小弟了。如需整个项目(就是实现一个级联下拉列表,改变省份下拉列表的值,自动显示该省份对应的县市)的源码请留QQ或邮箱,谢过各位~