home / experts / javascript / column74 |
|
Setting Events in Internet ExplorerIn order to understand the new event model in Netscape 6, you need also to refresh your knowledge of how it is done in Internet Explorer. Internet Explorer introduced the concept of event bubbling. As oppose to Netscape Navigator 4.x where events dive from thewindow object to the target object, an event in Internet Explorer bubbles from the target object outwards to the window object, propagating through all involved objects along the way. Each object can intercept the event and process it. The order of event interception is determined by the bubbling order. The target object is always first, followed by any higher objects in the hierarchy. Let's take an example.
Our sample paragraph includes a single sentence, part of it in bold. We attach an
Both event handlers pop up an alert box. First, is the bold text's alert box ('Thank you for clicking somewhere in the bold section!'), followed by the paragraph's alert box (
And here is the result. Try clicking the bold text:
This is a paragraph, and these are bold words in the paragraph. Next: How to set event handlers in Netscape 6 |
Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: January 1, 2001
Revised: January 1, 2001
URL: http://www.webreference.com/js/column74/3.html