<div class="htmlarea"> <textarea id="runcode64385"> <script language="JavaScript"> <!-- var currentMoveObj = null; //当前拖动对象 var relLeft; //鼠标按下位置相对对象位置 var relTop; function f_mdown(obj) { currentMoveObj = obj; //当对象被按下时,记录该对象 currentMoveObj.style.position = "absolute"; relLeft = event.x - currentMoveObj.style.pixelLeft; relTop = event.y - currentMoveObj.style.pixelTop; } window.document.onmouseup = function() { currentMoveObj = null; //当鼠标释放时同时释放拖动对象 } function f_move(obj) { if(currentMoveObj != null) { currentMoveObj.style.pixelLeft=event.x-relLeft; currentMoveObj.style.pixelTop=event.y-relTop; } } //--> </script> <table width="100" border="1" onselectstart="return false" style="position:absolute;left:50;top:50" onmousedown="f_mdown(this)" onmousemove="f_move(this)"> <tr> <td bgcolor="#CCCCCC" align="center" style="cursor:move">title1</td> </tr> <tr> <td align="center" height="60">content</td> </tr> </table> <table width="100" border="1" onselectstart="return false" style="position:absolute;left:350;top:250" onmousedown="f_mdown(this)" onmousemove="f_move(this)"> <tr> <td bgcolor="#CCCCCC" align="center" style="cursor:move">title2</td> </tr> <tr> <td align="center" height="60">content</td> </tr> </table> </textarea><br><input onclick="runEx('runcode64385')" type="button" value="运行代码"> <input onclick="doCopy('runcode64385')" type="button" value="复制代码"> <input onclick="doSave(runcode64385)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>