获取鼠标位置

<html>

<head>

<scriptsrc="http://code.jquery.com/jquery-latest.js"></script>

<scripttype="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>

相关推荐