void initEvent(string type, boolean bubbles, boolean cancelable)
This method initializes the
properties of an Event object. Create
a new event object by passing the string “Event” to the
Then, after initializing it with this method, dispatch it on any
by passing it to the
method of that target. The other standard event properties (besides
) will be initialized by the dispatch. If you want to create, initialize,
and dispatch a more complicated synthetic event, you’ll have to pass a different argument
(such as “MouseEvent”) to
and then initialize the event object with a type-
specific initializing function such as
(not documented in this book).
Tells the web browser not to perform the default action associated with this event, if there is
one. If the event is not of a type that is cancelable, this method has no effect. This method is
not defined on IE event objects, but is emulated by jQuery. In the IE event model, set the
, but in addition, prevent the invocation of any other handlers regis-
tered on the same document element. This method is a new addition to the standard event
model and may not be implemented in all browsers. It is not supported in the IE event model
but is emulated by jQuery.
Stops the event from propagating any further through the capturing, target, or bubbling pha-
ses of event propagation. After this method is called, any other event handlers for the same
event on the same node are called, but the event is not dispatched to any other nodes. This
method is not supported in the IE event model, but it is emulated by jQuery. In IE, set
to true instead of calling
The properties listed here are proposed by the current draft of the DOM Level 3 Events spec-
ification. They address key areas of incompatibility among today’s browsers but are not yet
(at the time of this writing) implemented by any browsers. If implemented interoperably they
will make it much easier to write portable code to handle text input events, key events, and
readonly unsigned short buttons
This property is like IE’s version of the
property described above.
readonly string char
For keyboard events, this property holds the character string (which may have more than
one character) generated by the event.
readonly string data
For textinput events, this property specifies the text that was input.
readonly unsigned long deltaMode
For wheel events, this property specifies the appropriate interpretation of the
properties. The value of this property will be one of these constants: