一下代码保存为.html运行试试看
<script >
function bb()
{
document.getelementbyid(test).style.top = event.clienty + document.body.scrolltop+5;
document.getelementbyid(test).style.left = event.clientx +document.body.scrollleft+5 ;
}
</script>
<body>
<div style=height:1000px; width:1000px; background:#ff0000; onmousemove=bb()>
<div id=test style= position:absolute;left:100px; top:110px; background-color:#cccccc; width:100px; height:100px;>aaa</div>
</div>
</body>