1 |
Object properties are accessed in natural o-o fashion:
|
2 |
var actualSelected = worldMenu.menuSelection;
|
3 |
familyMenu.color = 'red';
|
4 |
Curiously, in Netscape 2 you can also use array-like notation:
-
familyMenu[0] is same as familyMenu.no
-
familyMenu[1] is same as familyMenu.name etc.
|
5 |
We will return to this when we discuss arrays
|
6 |
One associates methods with user-defined objects, but with a syntax that appears very limiting since object methods have identical arguments to constructor function
|
7 |
General syntax is:
|
8 |
ObjectName.methodName = functionName;
|
9 |
where ObjectName is an existing object and functionName is an existing function Ñ it can be used to set event handlers with no arguments!
|