获取鼠标位置
程序员文章站
2022-03-02 18:13:19
...
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).mousemove(function(){
$("span").text("X: " + event.pageX + ", Y: " + event.pageY);
});
});
</script>
</head>
<body>
<p>鼠标指针位于: <span></span></p>
</body>
</html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).mousemove(function(){
$("span").text("X: " + event.pageX + ", Y: " + event.pageY);
});
});
</script>
</head>
<body>
<p>鼠标指针位于: <span></span></p>
</body>
</html>