




















































{
this.handle=this.handle.parentNode||this.handle.parentElement;
}
if(this.handle.title!='dragable')return;
this.handle.style.position='relative';
this.dx=parseInt(this.handle.style.left+0)-e.clientX;
this.dy=parseInt(this.handle.style.top+0)-e.clientY;
document.onmousemove=DragableObj.drag;
},

drag:function(e)...{
e=e||event;

if(this.handle!=null)...{
this.handle.style.left=(e.clientX+this.dx)+'px';
this.handle.style.top=(e.clientY+this.dy)+'px';
}
},

drop:function(e)...{
this.handle=null;
document.onmousemove=null;
}
};
document.onmousedown=DragableObj.init;
document.onmouseup=DragableObj.drop;

document.onselectstart=function(e)...{
e=e||event;
eo=e.target||event.srcElement;
if(eo.className.indexOf('drag')!=-1)returnfalse;
};

</
script
>
</
head
>
<
body
>
<
br
>
例1:
<
div
class
="box"
title
="dragable"
>
<
h3
class
="dragtitle"
>拖动标题
</
h3
>
<
div
class
="content"
>内容
</
div
>
</
div
>

<
br
>
例2:
<
div
class
="drag"
title
="dragable"
>
拖动我
</
div
>

</
body
>
</
html
>













































