Home > Article > Web Front-end > js simulate click event implementation code_javascript skills
html:
语法:
createEvent(eventType)
参数 | 描述 |
eventType | 想获取的 Event 对象的事件模块名。关于有效的事件类型列表,请参阅”说明”部分。 |
Return value
Returns a newly created Event object with the specified type.
Throws
If the implementation supports the required event type, this method will throw a DOMException exception with code NOT_SUPPORTED_ERR.
Description
This method will create a new event type, which is specified by the parameter eventType. 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 the legal values of eventType and the event interface created by each value:
|
Initialization method | |||||||||||||
HTMLEvents | HTMLEvent | iniEvent() | ||||||||||||
MouseEvents | MouseEvent | iniMouseEvent() | ||||||||||||
UIEvents | UIEvent | iniUIEvent() |
After creating the Event object using this method, the object must be initialized using the initialization method shown in the table above. For details on initialization methods, see the Event object reference. This method is actually not defined by the Document interface, but by the DocumentEvent interface. If an implementation supports the Event module, then the Document object implements the DocumentEvent interface and supports this method.