移動鼠標查看效果:
完整代碼:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JQ獲得鼠標位置-</title>
<script type="text/javascript" src="http:///keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>
</head>
<body>
<a href="http:///a/bjac/8p1g5yeq.htm" target="_blank">原文</a>
<div id="mousePosition_keleyi_com" style="border:1px solid silver;width:219px;height:23px"></div>
<script type="text/javascript">
$(document).mousemove(function (e) {
var xy_keleyi_com="x坐標:"+ e.pageX+",y坐標:"+ e.pageY;
$("#mousePosition_keleyi_com").text(xy_keleyi_com);
})
</script>
</body>
</html>