HTML and CSS Reference
In-Depth Information
Figure 13.35
Firefox—The mouse was clicked in the textbox but captured first in the
form.
Figure 13.36
Firefox—A key was pressed in the textbox.
We devoted a whole section of this chapter to handling mouse event handlers and what hap-
pens if the mouse rolls over a link or an image. In this section we discuss how to find out
what event the mouse triggered and where the mouse was positioned when it fired. For
browser compatibility tables see
http://www.quirksmode.org/dom/w3c_cssom.html.
Mouse Position.
The
client X
and
clientY
properties (Internet Explorer) and
pageX
and
pageY
properties (Firefox) are used to get the coordinate positions of the mouse
pointer in the document when the event is triggered. If you want to get the coordinate
positions of the mouse within an element, then you would use the
offsetX
and
offsetY
properties (Internet Explorer) and nonstandard
layerX
and
layerY
(Firefox).