event.screenX

JavaScript 1.2+, JScript 3.0+ Nav4+, IE 4+ Syntax

							event.screenX

Description

The screenX property of the event object controls the horizontal (x-coordinate) positioning within the computer screen in which the event occurred.

Example

Listing 7.211 shows an example of how to determine the x-coordinate of the cursor relative to the screen of where the click event occurred. The code captures the CLICK event. When captured, control is passed to the handle() function, which determines the x-coordinate position using the screenX property.

Listing 7.211 Using the screenX Property
 <html> <head> <title>Example of the event.screenX property</title> </head> <body> <script language = "JavaScript"> <!--Hide // sets up the window to ...

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.