createEvent() Event Method
- Previous Page createElement()
- Next Page createTextNode()
- Go to the Previous Level HTML DOM Documents
Definition and Usage
createEvent()
The method creates an event object.
The event can be any valid event type and must be initialized before use.
Example
Simulate mouseover event:
var x = document.createEvent("MouseEvent"); x.initMouseEvent("mouseover", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); document.getElementById("myDiv").dispatchEvent(x);
Syntax
document.createEvent(type)
Parameter Value
Parameter | Description |
---|---|
type |
Required. String, specifies the event type. Possible Values:
|
Technical Details
Return Value: | Event Object |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this method.
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
createEvent() | Support | Support | Support | Support | Support |
- Previous Page createElement()
- Next Page createTextNode()
- Go to the Previous Level HTML DOM Documents