<script type="text/javascript">
document.onmouseup=new Function("tag=false");
var tag=false;
var tempx,tempy;
function ondown()
{
iex=event.clientX;
iey=event.clientY;
tag=true;
tempx=document.all.mydiv.style.pixelLeft;
tempy=document.all.mydiv.style.pixelTop;
document.onmousemove=onmove;  
}
function onmove()
{
    if(tag==true)
{
   document.all.mydiv.style.pixelLeft=tempx+event.clientX-iex;
   document.all.mydiv.style.pixelTop=tempy+event.clientY-iey;
}}</script></head><body>
<div id="mydiv" style="width:200px; height:200px; position:absolute; background-color:#999999;" onmousedown="ondown()"></div>
</body>
</html>