Name

clientX, clientY — NN n/a IE 4 DOM n/a

Synopsis

Read-only

The horizontal (x) and vertical (y) coordinate of the mouse at the moment the current event fired. These coordinates are relative to the viewable document area of the browser window or frame.

Example

if ((event.clientX >= 10 || event.clientX <= 20) && 
(event.clientY >= 50 || event.clientY <= 100)) {
    process code for click in hot zone bounded by 10,50 and 20,100
}

Value

Integer of pixel values.

Default

None.

Get Dynamic HTML: The Definitive Reference 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.