<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>