<script>
var xx=0,yy=0;
function a(v)
{
xx=event.x-v.offsetLeft;
yy=event.y-v.offsetTop;
}
function b(v)
{
v.style.left=event.x-xx;
v.style.top=event.y-yy;
}
</script>
<img id="img" src="www.baidu.com/img/baidu_logo.gif" style="position:absolute;" οndragstart="a(this);" οndrag="b(this);" >
var xx=0,yy=0;
function a(v)
{
xx=event.x-v.offsetLeft;
yy=event.y-v.offsetTop;
}
function b(v)
{
v.style.left=event.x-xx;
v.style.top=event.y-yy;
}
</script>
<img id="img" src="www.baidu.com/img/baidu_logo.gif" style="position:absolute;" οndragstart="a(this);" οndrag="b(this);" >