AJAX简单应用实例-弹出层
程序员文章站
2022-07-01 23:37:45
function createobj() { if (window.activexobject) { &nb...
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
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
上一篇: 【C++并发实战】(一)并发基本概念
下一篇: 数据转为YOLO的txt数据格式