AJAX简单应用实例-弹出层
2018-09-06 13:15
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;
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=ewindow.event;
varobj=self.obj;//指向自己
else{obj.position={x:e.offsetX,y:e.offsetY};}
document.onmousemove=self.start;
document.onmouseup=self.end;
}
this.start=function(e)
{
e=eevent;
document.onselectstart=function(){returnfalse;};
window.getSelection&&window.getSelection().removeAllRanges();
varobj=self.obj;
obj.style.left=e.clientX-obj.position.x+px;
}
this.end=function(e)
{
e=eevent;
document.onmousemove=document.onmouseup=document.onselectstart=null;
}
}
AJAX简单应用实例-弹出层.rar
上一篇:让 Asp 与 XML 交互