JS 드래그 기술 --- setCapture 정보(Jiandanqinxin-.Net 연구 노트에서 재인쇄) 코드 복사 코드는 다음과 같습니다. <br><!-- <BR>window.onload=function(){ <BR>objDiv = document.getElementById(' drag'); <BR>drag(objDiv); <BR>}; <BR>function drag(dv){ <BR>dv.onmousedown=function(e){ <BR>var d=document; = e || window.event; <BR>var x= e.layerX || e.offsetX; <BR>var y= e.layerY || e.offsetY; if (dv.setCapture){ <BR>dv.setCapture(); <BR>}else if(window.captureEvents){ <BR>window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP) <BR> <BR>d.onmousemove=function(e){ <BR>e=e || window.event <BR>if(!e.pageX)e.pageX=e.clientX <br>if(!e .pageY)e.pageY=e.clientY; <br>var ty=e.pageY-y; <BR>dv . style.top=ty; <BR>}; <BR>d.onmouseup=function(){ <BR>//캡처 범위 취소<BR>if(dv.releaseCapture){ <BR>dv.releaseCapture() ; <BR>}else if(window.captureEvents){ <BR>window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP) <BR>} <BR>//이벤트 지우기<BR>d.onmousemove=null; 🎜> d.onmouseup=null; <BR>} <BR>//-> <br><div id="drag" style= "위치:절대;왼쪽:12px;상단:24px;너비:100;높이:150;테두리:1px 단색 #000000;z-index:1;배경:#eeeeee">끌어주세요</div> 🎜> <br> </div>