oDiv.onmousedown=function(e){
var e=e||window.event;
var diffX=e.clientX-oDiv.offsetLeft;//求出点击处和oDiv左边的距离
var diffY=e.clientY-oDiv.offsetTop;//求出点击处和oDiv上边的距离
document.onmousemove=function(e){
var e=e||window.event;
var left=e.clientX-diffX;
var top=e.clientY-diffY;
if(left<0){
left=0;
}else if(left>document.documentElement.clientX-oDiv.offsetWidth){
left=document.documentElement.clientX-oDiv.offsetWidth;
}
f(top<0){
top=0;
}else if(top>document.documentElements.clientWidth-oDiv.offseHeight){
top=document.documentElements.clientHeight-oDiv.offsetHeight;
}
oDiv.style.left=left+"px";
oDiv.style.Top=right+"px";
}
document.onmouseup=function(){
document.onmousemove=null;//注销move事件
document.onmouseup=null;//注销up事件,避免累计
}
}
弹窗时可以禁用滚动条