163Chapter 15 .Generic HTML Element (Ecommerce web host) Objects detachEvent() See
163Chapter 15 .Generic HTML Element Objects detachEvent() See attachEvent(). dispatchEvent(eventObject) Returns: Boolean. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The dispatchEvent() method allows a script to fire an event aimed at any object capable of supporting that event. This is the W3C event model way of generalizing mechanisms that earlier browsers sometimes mimic with object methods such as click() and focus(). The process of generating one of these events is similar to the way a script generates a new node and inserts that node somewhere in the document object model. For events, however, the object that is created is an Event object, which is generated via the document.createEvent() method. An event generated in this manner is simply a specification about an event. Use properties of an event object to supply specifics about the event, such as its coordinates or mouse button. Then dispatch the event to a target object by invoking that target object s dispatchEvent() method and passing the newly created Eventobject as the sole parameter. Interpreting the meaning of the Boolean value that the dispatchEvent() method returns is not straightforward. The browser follows the dispatched event through whatever event propagation is in effect for that object and event type (either bubbling or capture). If any of the event listener functions that are triggered by this dispatched event invoke the preventDefault()method, the dispatchEvent() method returns falseto indicate that the event did not trigger the native action of the object; otherwise, the method returns true. Notice that this returned value indicates nothing about propagation type or how many event listeners run as a result of dispatching this event. While the dispatchEvent() method is implemented in NN6, the browser does not yet provide a way to generate new events from scratch. And if you attempt to redirect an existing event to another object via the dispatchEvent() method, the browser is prone to crashing. Example (with Listing 15-25) on the CD-ROM Related Item: fireEvent() method. On the CD-ROM Caution elementObject.dispatchEvent()
In case you need quality webspace to host and run your web applications, try our personal web hosting services.