인터넷정보

마우스로 드래그되는 레이어창 스크립트

알 수 없는 사용자 2007. 10. 11. 17:14

<script>
var dragapproved=false
function drag_dropie(){
if (dragapproved==true){
document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
document.all.showimage.style.pixelTop=tempy+event.clientY-iey
return false
}
}
function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=showimage.style.pixelLeft
tempy=showimage.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}

if (document.all){
document.onmouseup=new Function("dragapproved=false")
}
</script>

<div id="showimage" style="position:absolute;width:250px;left:300px;top:200px">
<table border="1" onMousedown="initializedragie()" style="cursor:hand" >
<tr>
   <td> 움직일.. 레이어창.. </td>
  </tr>
</table>

</div>

반응형