<html>
<head> <title></title> <script type="text/javascript"> document.onmousemove = function () { var x = window.event.clientX; var y = window.event.clientY; var divFly = document.getElementById("divFly"); if (!divFly) {//判断图片是否加载完了,如果没加载 return; } divFly.style.left = x; divFly.style.top = y; }; </script> </head> <body> <div id="divFly" style=" position:absolute"> <img src="Images/cry.gif" /><br /> 你欺负我~ </div> </body> </html>