XML DOM createEvent() method
Definition and usage
The createEvent() method creates a new Event Object.
Syntax:
createEvent(eventType)
Parameters | Description |
---|---|
eventType | The event module name of the Event object you want to get. For the effective event type list, please refer to “DescriptionPart. |
Return Value
Returns the newly created Event Object, with the specified type.
thrown
If the implementation supports the required event type, this method will throw a NOT_SUPPORTED_ERR code DOMException Exception.
Description
This method will create a new event type, which is defined by the parameter eventType specified. Note that the value of this parameter is not the name of the event interface to be created, but the name of the DOM module that defines that interface.
The following table lists eventType and the valid values and the event interfaces created by each value:
Parameters | Event Interfaces | Initialization Methods |
---|---|---|
HTMLEvents | HTMLEvent | iniEvent() |
MouseEvents | MouseEvent | iniMouseEvent() |
UIEvents | UIEvent | iniUIEvent() |
After creating an Event object with this method, you must initialize the object with the initialization methods shown in the table above. For more details on the initialization methods, please refer to Event Object Reference.
This method is not actually defined by the Document interface, but by the DocumentEvent interface. If an implementation supports the Event module, then Document ObjectThe Document object will implement the DocumentEvent interface and support this method.