<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>jquery获取鼠标的位置</title> <meta name="author" content="DeathGhost" /> <style> </style> <script src="jquery.js"></script> <script src="get.js"></script> </head> <body style="width:1000px;height:1000px"> </body> </html>
get.js:
$(function(){
$("body").mousemove(function(e){
console.info("x :" + e.pageX);
console.info("y :" + e.pageY);
});
});
效果: