Internet Explorer 5.0, Part II: More on DHTML Behaviors - Doc JavaScript
More on DHTML Behaviors
In our previous column we introduced Behaviors, the most significant new JavaScript feature of Internet Explorer 5.0. We have shown how to write a behavior scriptlet and how to communicate between the scriptlet and the containing page. This interface handling is accomplished by the Behavior Handler. The Behavior Handler:
- Notifies the behavior scriptlet of certain occurrences, such as when the calling document is loaded.
- Exposes custom events to the calling page.
- Exposes the element that the behavior is associated with to the scriptlet.
We explain the Behavior Handler via a new example, the popular Connect Three game. It is played by two opponents on a 3x3 board. Each opponent, in his or her turn, places a game piece in one of the unoccupied board locations. In our example, one opponent is using "X"s and the other one is using "O"s. The first to accomplish a row, a column, or a diagonal of identical pieces is the winner.
In this column you'll learn:- How to use the Behavior Handler's
event
element. - How to use the Behavior Handler's
element
property. - How to use the Behavior Handler's
attachNotification()
method. - How to use the Behavior Handler's
createEventObject()
method. - How to use the Behavior Handler's
fireEvent()
method. - How to use the Behavior Handler's
attachEvent()
anddetachEvent()
methods. - How to specify the Behavior Handler's location.
- How to use the Behavior Handler's
uniqueID
property.
At this point you may also view the entire file for the hosting page and the behavior scriptlet.
Created: August 11, 1998
Revised: August 11, 1998
URL: https://www.webreference.com/js/column23/