Java Reference
In-Depth Information
properties of the
mouseevent objeCt
desCription
Indicates whether the Alt key was pressed when the event was
generated
altKey
Indicates which button on the mouse was pressed
button
Indicates where in the browser window, in horizontal coordinates,
the mouse pointer was when the event was generated
clientX
Indicates where in the browser window, in vertical coordinates, the
mouse pointer was when the event was generated
clientY
Indicates whether the Ctrl key was pressed when the event was
generated
ctrlKey
Indicates whether the meta key was pressed when the event was
generated
metaKey
Used to identify a secondary event target. For
mouseover
events,
this property references the element at which the mouse pointer
exited. For
mouseout
events, this property references the element
at which the mouse pointer entered
relatedTarget
Indicates the horizontal coordinates relative to the origin in the
screen
screenX
Indicates the vertical coordinates relative to the origin in the screen
screenY
Indicates whether the Shift key was pressed when the event was
generated
shiftKey
Although any event might create an
Event
object, only a select set of events can generate a
MouseEvent
object. On the occurrence of a
MouseEvent
event, you'd be able to access properties
from the
Event
object and the
MouseEvent
object. With a non‐mouse event, none of the
MouseEvent
object properties in the preceding table would be available. The following mouse
events can create a
MouseEvent
object:
➤
click
occurs when a mouse button is clicked (pressed and released) with the pointer over an
element or text.
➤
mousedown
occurs when a mouse button is pressed with the pointer over an element or text.
➤
mouseup
occurs when a mouse button is released with the pointer over an element or text.
➤
mouseover
occurs when a mouse button is moved onto an element or text.
➤
mousemove
occurs when a mouse button is moved and it is already on top of an element or
text.
➤
mouseout
occurs when a mouse button is moved out and away from an element or text.