AJAX简单应用实例-弹出层
AJAX简单应用实例-弹出层
发布时间:2017-01-14 来源:查字典编辑
摘要:functioncreateobj(){if(window.ActiveXObject){return(newActiveXObject("...

functioncreateobj(){

if(window.ActiveXObject){

return(newActiveXObject("Microsoft.XMLHTTP"));

}

elseif(window.XMLHttpRequest){

return(newXMLHttpRequest());

}

}

functionpersonalInfo(){

varoBao=createobj();

varcont=document.getElementById("person_detial");

varcont_a=document.getElementById("person_content");

cont.style.display='block';

cont.style.cursor='pointer';

cont_a.innerHTML="请等待,加载中...";

varmy_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();

}

functionDrag(id)

{

varself=this;

this.obj=(typeof(id)=="string")?document.getElementById(id):id;

this.obj.onmousedown=function(e)

{

e=e||window.event;

varobj=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(){returnfalse;};

window.getSelection&&window.getSelection().removeAllRanges();

varobj=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

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新ASP教程学习
热门ASP教程学习
编程开发子分类