<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>さまざま; <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 = マウス移動; <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" style="位置:絶対; 左:100px; 高さ:100px; 幅:100px; 背景色:#FF0;" <BR>onmousedown="mousedown()" onmouseup="mouseup()" > <br> </div> <br></body> <br></html> <br>