# EventTarget : Object
Return to: HTML DOM Level 2 index

Allows registration and removal of an EventListener on an EventTarget.

## Platform Support

IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | ---
4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+

## Constructors

Constructor | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
EventTarget Constructor() : EventTarget Allows registration and removal of an EventListener on an EventTarget. | Show Details | 4.0+ | 1.0+ | 4.0+ | 7.0+ | 1.0+

### EventTarget() : EventTarget

Allows registration and removal of an EventListener on an EventTarget.

Returns

EventTarget |

Visibility
  internal

## Functions

Method | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
addEventListener(String type, EventListener listener, Boolean useCapture) : void Adds an event listener to the set of event listeners for the node. | Show Details | no | 1.0+ | no | 7.0+ | 1.0+

Parameters

String | type | Type of event for the event listener.
EventListener | listener | Event listener function to be invoked.
Boolean | useCapture | Specify "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.

Returns

void |

  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(). | Show Details | no | 1.0+ | 4.0+ | 7.0+ | 1.0+

Parameters

Event | event | Specifies Event object to be dispatched.

Returns

Boolean |

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. | Show Details | no | 1.0+ | no | 7.0+ | 1.0+

Parameters

String | type | Type of event.
EventListener | listener | Event listener to be removed.
Boolean | useCapture | Specify "true" to remove a capturing event listener. Specify "false" to remove all other types of event listeners.

Returns

void |

  For examples, see the quirksmode test page:

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

Availability

  HTML DOM Level 2|W3C

## References

Event|EventListener

## Availability

HTML DOM Level 2|W3C

text_javascript aptana_docs