<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
#container1{
position:absolute;
background-color:rgb(255,255,255);
border:1px solid #000000;
width:200px;
height:200px;
left:50px;
top:50px;
}
#container2{
position:absolute;
background-color:rgb(255,255,255);
border:1px solid #000000;
width:200px;
height:200px;
left:200px;
top:200px;
}
.drag{
cursor:move;
position:absolute;
background-image:url(./drag.png);
width:20px;
height:20px;
}
.resize{
position:absolute;
background-image:url(./resize.png);
width:20px;
height:20px;
}
</style>
<script type="text/javascript">
var altx,alty;
altx = 0;
alty = 0;
var object;
var left,top;
var wid,hei;
var dragobject;
var resizeobject;
function selectDrag(obj,event){
dragobject = obj;
altx = event.clientX;
alty = event.clientY;
}
function releasedrag(){
dragobject = null;
resizeobject = null;
altx = 0;
alty = 0;
}
function drag(e){
if(dragobject){
object = dragobject.offsetParent;
left = object.style.left.substr(0,object.style.left.indexOf('px'));
top = object.style.top.substr(0,object.style.top.indexOf('px'));
object.style.left = (parseInt(left) + e.clientX - altx) + "px";
object.style.top = (parseInt(top) + e.clientY - alty) + "px";
altx = e.clientX;
alty = e.clientY;
}
}
</script>
</head>
<body onmousemove="drag(event);" onmouseup="releasedrag();" >
<div id="container1" style="left:50px;top:50px;width:200px;height:200px;">
<div class="drag" id="drag" style="left:175px;top:5px;" onmousedown="selectDrag(this,event);"></div>
<div class="resize" style="left:180px;top:180px;"></div>
</div>
<div id="container2" style="left:200px;top:200px;width:200px;height:200px;">
<div class="drag" id="drag" style="left:175px;top:5px;" onmousedown="selectDrag(this,event);"></div>
<div class="resize" style="left:180px;top:180px;"></div>
</div>
</body>
</html>