RSS
热门关键字:  java  Ajax  JSP  JSF  Struts
当前位置 : 首页>Ajax>列表

AJAX+jsp无刷新验证码实例

来源: 作者: 时间:2007-09-21 点击:

      this.req = new ActiveXObject("Msxml2.XMLHTTP");
   }catch (e1){
     try {
      this.req = new ActiveXObject("Microsoft.XMLHTTP");     
      } catch (e2){
    }
   }
     //
 //this.req=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (this.req)
  {
 try
 {
   var loader=this;
   this.req.onreadystatechange=function()
   {
  net.ContentLoader.onReadyState.call(loader);
   }
   this.req.open(method,url,true);
   if (contentType)
   {
    this.req.setRequestHeader('Content-Type', contentType);
   }
   this.req.send(params);
 }
 catch (err)
 {
   this.on_error.call(this);
 }
  }
}
net.ContentLoader.onReadyState=function(){
  var req=this.req;
  var ready=req.readyState;
  if (ready==net.READY_STATE_COMPLETE){
 var httpStatus=req.status;
 if (httpStatus==200 || httpStatus==0){
   this.on_load.call(this);
 }else{
   this.on_error.call(this);
 }
  }
}
net.ContentLoader.prototype.defaultError=function(){
  alert("error fetching data!"
 +"\n\nreadyState:"+this.req.readyState
 +"\nstatus: "+this.req.status
 +"\nheaders: "+this.req.getAllResponseHeaders());
}

共4页: 上一页 [1] [2] [3] 4 下一页
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
热点关注
Google Adsense
相关文章