javascript document createEvent( )
createEvent( ) | Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 2 |
createEvent("eventType") |
|
Generates in memory an instance of a W3C DOM Event object of a particular event category. After the generic event is created, it must be initialized (via one of several initialization methods) as a particular event type, along with other properties appropriate for the event category. The following sequence creates a mousedown event and sends it to an element: var evt = document.createEvent("MouseEvents");evt.initEvent("mousedown", true, true); document.getElementById("myElement").dispatchEvent(evt); |
|
Such an event might then be handed to an element (via the element's dispatchEvent( ) method) so that the element's event listener can process the event as if it had been generated by a user clicking the mouse button. |
|
Parameters | |
|
|
Returned Value | |
Event object object reference. |
Powered by Linode.