<head>
<script type="text/javascript">
// 当监听事件受到body范围大小的限制的时候,那么就在document中监听
document.onmousemove = function () {
//获得鼠标的坐标值
var x = window.event.clientX;
var y = window.event.clientY;
var divfly = document.getElementById("divFly");
divfly.style.left = x;
divfly.style.top = y;
}
</script>
</head>
<body>
<div id="divFly" style="position:absolute">
<img src="../images/b6.gif" alt="PositionDemo" />
</div>
</body>