我需要在桌子的左上角点 0:0。
现在鼠标的位置是从首页开始测量的
<h2>
TestPosition</h2>
<table cellpadding="0" id="target" cellspacing="0" width="602" height="500" style="float: left;
margin: 0px; padding: 0px; position: relative; background: url(/content/games/kamikaze2/back.jpg) no-repeat 0 0;">
</table>
<div id="log">
</div>
<script type="text/javascript">
$("#target").mousemove(function (event) {
var thisPosX = $(this).position().left;
var thisPosY = $(this).position().top;
var relX = (event.clientX - thisPosX);
var relY = (event.clientY - thisPosY);
var msg = "Handler for .mousemove() called at ";
msg += relX + ", " + relY;
$("#log").html("<div>" + msg + "</div>");
});
</script>