日期:2014-05-16 浏览次数:20340 次
<script language="javascript"> var tmpObj; var relLeft,relTop; function layerMouseDown(obj) { tmpObj=obj tmpObj.l=event.x-tmpObj.style.pixelLeft tmpObj.t=event.y-tmpObj.style.pixelTop } function layerMouseMove() { if(tmpObj!=null) { tmpObj.setCapture() tmpObj.style.left = event.x-tmpObj.l tmpObj.style.top = event.y-tmpObj.t } } function layerMouseUp() { if(tmpObj!=null) { tmpObj.releaseCapture() tmpObj=null } } </script>
function layerMouseMove() { if(tmpObj!=null) { tmpObj.setCapture() tmpObj.style.left = event.x-tmpObj.l tmpObj.style.top = event.y-tmpObj.t var left=parseInt(tmpObj.style.left); var top=parseInt(tmpObj.style.top); var maxLeft=parseInt(document.body.clientWidth)-parseInt(tmpObj.style.width); var maxLeft=parseInt(document.body.clientHeight)-parseInt(tmpObj.style.height); if(left<0){ tmpObj.style.left="0px"; } if(left>maxLeft){ tmpObj.style.left=maxLeft+"px"; } if(top<0){ tmpObj.style.top="0px"; } if(top>maxTop){ tmpObj.style.top=maxTop+"px"; } } }