<div class="codetitle"> <span><a style="CURSOR: pointer" data="21450" class="copybut" id="copybut21450" onclick="doCopy('code21450')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code21450"> <br><html> <br><머리> <br><script type="text/javascript"> <br>var x; <br>var y; <br>function $(id) <br>{ <br>return document.getElementById(id) <br>} <br>function mousedown() <br>{ <br>x=event.clientX-$("px ").style.pixelLeft; <br>y=event.clientY-$("px").style.pixelTop; <br>$("px").style.border="2px 단색 빨간색"; <br>$("px").onmousemove = mousemove; <br>} <br>function mouseup() <br>{ <br>$("px").onmousemove = ""; <br>$("px").style.border=""; <br>} <br>function mousemove() <br>{ <br>$("px").style.pixelLeft=event.clientX-x; <br>$("px").style.pixelTop=event.clientY-y; <br>} <br></script> <br></head> <br><본문> <br><div id="px" 스타일="위치:절대; 왼쪽:100px; 높이:100px; 너비:100px; 배경색:#FF0;" <BR>onmousedown="mousedown()" onmouseup="mouseup()" > <br></div> <br></body> <br></html> <br> </div>