|
December 26, 1999 Sharing Behaviors Tips: December 1999
Yehuda Shiran, Ph.D.
|
|
We have shown in previous tips (December 24, 1999, December 23, 1999, and December 25, 1999) how to define a Behavior and associate it with one DHTML element. But the real power of Behaviors is that a single Behavior can be shared by several DHTML elements. By assigning different values to the scriptlet's properties, slightly different behaviors can be achieved. Here is our single Blinking Soccer from Column 22, DHTML Behaviors:
Now, let's add five more soccer balls, in different window's locations. The
Sharing a single module by several elements is one of the cornerstones of any object-oriented languages. It is more than calling a procedure with different arguments. Object-oriented modules encapsulate both data and methods that can operate on this data. Behaviors are exactly that.
People who read this tip also read these tips: Look for similar tips by subject: |