jquery中通过鼠标获取页面坐标

时间:2022-05-06
本文章向大家介绍jquery中通过鼠标获取页面坐标,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<title>jquery_shijian_function.html</title>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$(document).mousemove(function(e){
					$(".span").text("X:"+e.pageX+" , Y:"+e.pageY);
				});
			});
		</script>
	</head>
	<body>
		<div>
			<p>鼠标指针位于:<span class="span"></span></p>
		</div>
	</body>
</html>