Ano-Tech Computers
Enter keyword:

Javascript: Coordinates of mouse event
Problem:
What is the proper way to find the document coordinates where a mouse event occurred?
 
Solution:
Internet Explorer notwithstanding, use the following code:

var posx = window.pageXOffset + event.clientX;
var posy = window.pageYOffset + event.clientY;

 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles