代码如下:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style type="text/css">
#im {
position: absolute;
width: 66px;
}
</style>
</head>
<body>
<img src="timg.gif" id="im" alt="" />
<script type="text/javascript">
var imobj = document.getElementById("im");
document.onmousemove = function (e) {
imobj.style.left = e.clientX + 25 + "px";
imobj.style.top = e.clientY + "px";
}
</script>
</body>
</html>
效果演示:https://fifteen718.github.io/