AJAX简单应用实例-弹出层

时间:2021-05-28

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

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章