A demonstration of the differences between clientX and clientY and screenX and screenY:
<!DOCTYPE html> <html> <head> <style> div {//from ww w . jav a 2 s . c o m width: 500px; height: 300px; border: 1px solid black; text-align: center; } </style> </head> <body> <div onclick="showCoords(event)"><p id="demo"></p></div> <script> function showCoords(event) { var pX = event.pageX; var cX = event.clientX; var pY = event.pageY; var cY = event.clientY; var coords1 = "page - X: " + pX + ", Y coords: " + pY; var coords2 = "client - X: " + cX + ", Y coords: " + cY; document.getElementById("demo").innerHTML = coords1 + "<br>" + coords2; } </script> </body> </html>