当前位置: 移动技术网 > IT编程>开发语言>Asp > AJAX简单应用实例-弹出层

AJAX简单应用实例-弹出层

2017年12月12日  | 移动技术网IT编程  | 我要评论
function createobj() {
 if (window.activexobject) {
         return(new activexobject("microsoft.xmlhttp"));
     }
     else if (window.xmlhttprequest) {
         return(new xmlhttprequest());
     }
}


function personalinfo() {
  var obao=createobj();
  var cont=document.getelementbyid("person_detial");
  var cont_a=document.getelementbyid("person_content");
  cont.style.display='block';
  cont.style.cursor='pointer';
  cont_a.innerhtml="请等待,加载中..."; 
  var my_url="getinfo.asp?"+math.random();
  obao.open("get",my_url,true); 
  obao.onreadystatechange=function(){
  if(obao.readystate==4){
   if(obao.status==200){ 
     cont_a.innerhtml=obao.responsetext;
     }else{
     cont_a.innerhtml="出现错误,错误代码为:"+obao.status;
    }  
  }
  }
  obao.send(); 
 }



function drag(id)
{
var self=this;
this.obj=(typeof(id)=="string")?document.getelementbyid(id):id;
this.obj.onmousedown=function(e)
{
e=e||window.event;
var obj=self.obj;//指向自己
if(e.layerx){obj.position={x:e.layerx,y:e.layery};}
else{obj.position={x:e.offsetx,y:e.offsety};}
document.onmousemove=self.start;
document.onmouseup=self.end;


}
this.start=function(e)
{
e=e||event;
document.onselectstart = function(){ return false; };
window.getselection && window.getselection().removeallranges();
var obj=self.obj;
obj.style.left=e.clientx-obj.position.x+"px";
obj.style.top=e.clienty-obj.position.y+"px";
}
this.end=function(e)
{
e=e||event; 
document.onmousemove = document.onmouseup = document.onselectstart = null;     
}
}
ajax简单应用实例-弹出层.rar

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网