一个可托动层的例子 
<body style=margin: auto; onLoad=divMove();>
<div style=left:0;top:0;position:relative;overflow:hidden;width:100%;height:100% id=div1>
<img src=img.jpg style=position:relative;left:0px;top:0px;width:100px;height:100px;cursor:hand; class=imgObj>
</div>
</body>
<script language=javascript>
var checkMoving;
function divMove(){
checkMoving = false;
document.onmousedown=startMove;
document.onmousemove=moveObj;
document.onmouseup=new Function(checkMoving = false);
}function startMove(){
if(event.srcElement.className!=imgObj) return;
checkMoving=true;
Xdiff=event.clientX-event.srcElement.style.pixelLeft;
Ydiff=event.clientY-event.srcElement.style.pixelTop;
}function moveObj(){
if(!checkMoving) return true;
event.srcElement.style.pixelLeft=event.clientX-Xdiff;
event.srcElement.style.pixelTop=event.clientY-Ydiff;
return false;
}
</script>