获取鼠标位置

<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>

你可能感兴趣的:(JavaScript,html,UI,鼠标位置)