Find the position of the mouse
Hi
Could not solve this:
Find the position of the mouse pointer relative to the left and top edges of the document.
I wrote something like below (i know it is quite wrong :) ), would appreciate help in correcting it:
<!DOCTYPE html>
<html>
<head>
<script>
$(document).ready(function(){
$('body').mouseover(function(){
var x = $('body').offset();
$('body').append("Top: " + x.top + " Left: " + x.left);
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>
Regards
Jayashree