Section 25.66. Document.createEvent( ): create an Event object


25.66. Document.createEvent( ): create an Event object

DOM Level 2 Events:

25.66.1. Synopsis

 Event createEvent(String eventType)     tHRows DOMException 

25.66.1.1. Arguments

eventType

The name of the event module for which an Event object is desired. Valid event types are listed in the Description.

25.66.1.2. Returns

A newly created Event object of the specified type.

25.66.1.3. Throws

This method throws a DOMException with a code of NOT_SUPPORTED_ERR if the implementation does not support events of the requested type.

25.66.2. Description

This method creates a new event object of the type specified by the eventType argument. Note that the value of this argument should not be the (singular) name of the event interface to be created but instead should be the (plural) name of the DOM module that defines that interface. The following table shows the legal values for eventType and the event interface each value creates:

eventType argument

Event interface

Initialization method

HTMLEvents

Event

initEvent( )

MouseEvents

MouseEvent

initMouseEvent( )

UIEvents

UIEvent

initUIEvent( )


After creating an Event object with this method, you must initialize the object with the initialization method shown in the table. See the appropriate Event interface reference page for details about the initialization method.

This method is actually defined not by the Document interface but by the DOM DocumentEvent interface. If an implementation supports the Events module, the Document object always implements the DocumentEvent interface and supports this method. Note that Internet Explorer does not support the DOM Events module.

25.66.3. See Also

Event, MouseEvent, UIEvent




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net