EventTarget : Object

Allows registration and removal of an EventListener on an EventTarget.

Browser/User Agent Support

IEMozillaNetscapeOperaSafariNetscapte
4.0+1.0+4.0+7.0+1.0+no

Constructors

ConstructorIEMozillaNetscapeOperaSafariNetscapte
Allows registration and removal of an EventListener on an EventTarget.
4.0+1.0+4.0+7.0+1.0+no
 

Methods

MethodIEMozillaNetscapeOperaSafariNetscapte
Adds an event listener to the set of event listeners for the node.
no1.0+no7.0+1.0+no
 
Dispatches an event created by Document.createEvent().
no1.0+4.0+7.0+1.0+no
 
Removes an event listener from an event target.
no1.0+no7.0+1.0+no
 

References

Event | EventListener

Availability

HTML DOM Level 2 | W3C

Constructor Detail

EventTarget EventTarget()

Allows registration and removal of an EventListener on an EventTarget.

Visibility
internal

Method Detail

addEventListener(String type, EventListener listener, Boolean useCapture) : void

Adds an event listener to the set of event listeners for the node.

StringtypeType of event for the event listener.
EventListenerlistenerEvent listener function to be invoked.
BooleanuseCaptureSpecify "true" to invoke the event listener during the capturing phase of event propagation. Specify "false" to invoke the event listener when the node is the event target or when the event bubbles up to the current node.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/registration.html

See Also

Event | EventListener

Availability

HTML DOM Level 2 | W3C

dispatchEvent(Event event) : Boolean

Dispatches an event created by Document.createEvent().

EventeventSpecifies Event object to be dispatched.

Throws
Raises an UNSPECIFIED_EVENT_TYPE_ERR error if the type of Event was not specified by initializing the event before calling dispatchEvent, or if the Event type was null or an empty string.
See Also

Document.createEvent | Event.initEvent | MouseEvent.initMouseEvent

Availability

HTML DOM Level 2 | W3C

removeEventListener(String type, EventListener listener, Boolean useCapture) : void

Removes an event listener from an event target.

StringtypeType of event.
EventListenerlistenerEvent listener to be removed.
BooleanuseCaptureSpecify "true" to remove a capturing event listener. Specify "false" to remove all other types of event listeners.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/registration.html

Availability

HTML DOM Level 2 | W3C