event.pageX

JavaScript 1.2+ Nav4+ Syntax

							event.pageX

Description

The pageX property of the Event object controls the horizontal (x-coordinate) positioning within a Web page in which the event occurred.

Example

Listing 7.209 shows an example of how you can find the x-coordinate positioning of where the click event occurred within the browser. Simply click in the browser window and an alert box will appear indicating the value of the x-coordinate of where the mouse was clicked.

Listing 7.209 Example of Using the pageX Property
 <html> <head> <title>Example of the event.pageX property</title> </head> <body> <script language = "JavaScript"> <!--Hide // sets up the window to capture CLICK events window.captureEvents(Event.CLICK); // function ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.