87,904
社区成员
发帖
与我相关
我的任务
分享
<script>
var x,y,z,down=false,obj;
function init()
{
obj=event.srcElement;
obj.setCapture();
z=obj.style.zIndex;
obj.style.zIndex=100;
x=event.offsetX;
y=event.offsetY;
down=true;
}
function moveit()
{
if(down&&event.srcElement==obj)
{
with(obj.style)
{
obj.style.posLeft=document.body.scrollLeft+event.x-x;
obj.style.posTop=document.body.scrollTop+event.y-y;
}
if(event.x<125&&event.y<120)
{
obj.style.cursor="hand"
}
else
{
obj.style.cursor=""
}
}
}
function stopdrag()
{
down=false;
obj.style.zIndex=z;
obj.releaseCapture();
}
</script>
<body>
<img src="1.jpg" height="50" style="position:absolute;top:210;left:200" onmousedown="init()" onmousemove="moveit()" onmouseup="stopdrag()" />
<table style="width: 111px; height: 89px;index:1" border="1" >
<tr>
<td style="height: 85px">
</td>
</tr>
</table>