不过这里未使用事件捕捉和释放,呵呵~ JS_拽拉效果_脚本之家 div{position:absolute;width:200px;height:100px;background:#FFFADC;border:1px solid #CC6600;} var idid = document.getElementById('idid'); idid.onmousedown = function(bbb){ if(!bbb)bbb=window.event; var ox = bbb.layerX?bbb.layerX:bbb.offsetX; var oy = bbb.layerY?bbb.layerY:bbb.offsetY; idid.onmousemove = function(ccc){ if(!ccc)ccc=window.event; idid.style.left = ccc.clientX - ox + 'px'; idid.style.top = ccc.clientY - oy + 'px'; } idid.onmouseup = function(){ idid.onmousemove = null; } } [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]