XML DOM createEvent() methode

Document object reference manual

Definitie en gebruik

De createEvent() methode maakt nieuwe Event object.

Syntaxis:

createEvent(eventType)
Parameters Beschrijving
eventType

De naam van het event module van het Event object dat je wilt verkrijgen.

Over het effectieve evenementenlijst, raadpleeg "Description部分。

return value

returns the newly created Event objectwith the specified type.

throw

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 legal values for each value created by the event interface:

Parameters Event interface 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 objectIt will implement the DocumentEvent interface and support this method.

Document object reference manual