Detecting Mouse Position | JavaScriptSource

Detecting Mouse Position

Roy Marchand May 30, 2007

General

This is an easy way to determine the mouse position on a Web page. Click anywhere on the page and the coordinates will be displayed.


You can store them in form fields

x = y =

or as plain text

   

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: mousePosition.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(2 comments)

It really works in all browsers i tested. Thanks! I have tried many other types of cursor position functions but this really works and it is very easy to understand and use.[br /][br /]We thank you THE JAVASCRIPT SOURCE!

Adrian May 2, 2008

Thank's[br /]Interesting for use with CSS !

lavercq Jun 2, 2007