//마우스 정의 개체 끌기
drag=function (a,o){
var d=document;if(!a)a=window.event
if(!a.pageX)a.pageX=a.clientX; ;
if(!a.pageY)a.pageY=a.clientY;
var x=a.pageX,y=a.pageY;
if(o.setCapture)
o.setCapture ( );
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP)
var backData = {x : o.style.top, y : o.style. 왼쪽 }; d.onmousemove=function(a){
if(!a)a=window.event
if(!a.pageX)a.pageX=a.clientX; if (!a.pageY)a.pageY=a.clientY;
var tx=a.pageX-xparseInt(o.style.left),ty=a.pageY-yparseInt(o.style.top) ;
o.style.left=tx "px";
o.style.top=ty "px"
x=a.pageX; } ;
d.onmouseup=function(a){
if(!a)a=window.event;
if(o.releaseCapture)
o.releaseCapture()
else if (window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); X)a .pageX=a.clientX; Y)a.pageY=a.clientY;
if(!document.body.pageWidth)document.body.pageWidth=document.body.clientWidth;
If(!document.body.pageHeight)document.body.pageHeight=document.body.clientHeight; > if(a.pageX > }; 🎜>}
사용법:
코드 복사
코드는 다음과 같습니다.