一下代码保存为.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>
中国足彩网信息请查看IT技术专栏