DocumentEvent.createEvent() (Method)

A method to create a new event object ready to be dispatched to an EventTarget.

Availability:

DOM level - 2
JavaScript - 1.5
Netscape - 6.0
Property/method value type:Event object
JavaScript syntax:NmyDocumentEvent.createEvent(aType)
Argument list:aTypeA string containing an event type

The only argument to this method contains the event type value. This is discussed fully in the Event.type topic elsewhere. The method returns a freshly manufactured but uninitialized Event object.

The DOM specification describes how the event should be initialized by an appropriate initialization method.

During the execution of this method, it is possible to raise a DOM exception. The only one enumerated in DOM level 2 is the NOT_SUPPORTED_ERR value.

The following event types are defined in DOM level 2:

ValueEvent object type
HTMLEventsHTML Element objects
MouseEventsMouseEvent object
MutationEventsMutationEvent object
UIEventsUIEvent object

See also:Event.type, UIEvent.initUIEvent()