Java Reference
In-Depth Information
It's important to remember that when you register multiple event handlers on a single element,
the listening functions execute in the order in which you registered them. In this example, you
registered a listener with changeImg() before a listener with updateStatus() . This is ideal because
you want the status to display the URL of the image after you change it. If you had registered
updateStatus() before changeImg() , the status would update before the image, thus displaying
incorrect information.
using event data
The standard outlines several properties of the Event object that offer information about that event:
what element it happened at, what type of event took place, and what time it occurred. These are
all pieces of data offered by the Event object. The following table lists the properties outlined in the
specification.
properties of the
event objeCt
desCription
Indicates whether an event can bubble— passing control from
one element to another starting from the event target and
bubbling up the hierarchy
bubbles
Indicates whether an event can have its default action
canceled
cancelable
Identifies the current target for the event as the event traverses
the DOM
currentTarget
Indicates whether or not preventDefault() has been called
on the event
defaultPrevented
Indicates which phase of the event flow an event is in
eventPhase
Indicates which element caused the event; in the DOM event
model, text nodes are a possible target of an event
target
Indicates at what time the event occurred
timestamp
Indicates the name of the event
type
Secondly, the DOM event model introduces a MouseEvent object, which deals with
events generated specifically by the mouse. This is useful because you might need more
specific information about the event, such as the position in pixels of the cursor, or the
element the mouse has come from. The following table lists some of the MouseEvent object's
properties:
 
Search WWH ::




Custom Search