<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<style>
.test{text-align:center;width:300px;height:30px;line-height:30px;background:#f60;position:absolute;}
.test:hover{cursor:move;}
</style>
<div class="test">测试</div>
<br/><br/>
<h1>如果无效请刷新下页面..</h1>
<script>
;$(function(){
var isMove=false;
$(".test").mousedown(function(){isMove=true;}).mouseup(function(){isMove=false;});
$(document).mousemove(function(e){
if(!isMove){return;};
var X=e.clientX-parseInt($(".test").width()/2);
var Y=e.clientY-parseInt($(".test").height()/2);
$(".test").css({"left":X,"top":Y,"cursor":"move"});
});
});
</script>
来自:http://www.zhjie.net/drag-the-div-jquery-random-effects.htm