<div id=MoveDiv style="position:absolute;left:362px;top:158px;width:100;height:300;background:blue">
<div style=position:absolute;left:0;top:0;width:100;height:20;background:red οnmοusedοwn=MDown(MoveDiv)>
按这里移动
</div>
</div>
<script>
var Obj=''
document.οnmοuseup=MUp
document.οnmοusemοve=MMove
function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}
function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}
function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
</script>