javascript 層的拖動
<script language="JavaScript">
<!--
var Obj;
function MouseDown()
{
Obj=document.getElementById("dragDiv");
Obj.setCapture();
Obj.l=event.x-Obj.style.pixelLeft;
Obj.t=event.y-Obj.style.pixelTop;
}
function MouseMove()
{
if(Obj!=null)
{
Obj.style.left = event.x-Obj.l;
Obj.style.top = event.y-Obj.t;
}
}
function MouseUp()
{
if(Obj!=null)
{
Obj.releaseCapture();
Obj=null;
}
}
document.onmousedown=MouseDown;
document.onmousemove=MouseMove;
document.onmouseup=MouseUp
//-->
</script>
<div id="dragDiv" style="position:absolute;500px;height:100px;">11111
adsgadsgfasdgf </div>