javascript event x, y

x, yNN n/a IE 4 DOM n/a

Read-only

Return the horizontal and vertical pixel coordinates of the mouse pointer at the time the event occurred. For all but relative-positioned elements, the coordinate system is the body element (or html element in IE 6 standards-compatible mode). If the event occurs inside a relative-positioned element's rectangle, the coordinate system is limited to that element's space (the element's top left corner being 0,0). A value of -1 is returned if the pointer was outside of the document area of the browser window.

 
Example
 
if (evt.x < 20 && evt.y < 30) {
    ...
}
 
Value

Integer.

 
Default

None.


796,Nickname,Homepage or email,Comments here,Add comment