Basic HTML version of Foils prepared 23 June 1997

Foil 28 User-defined Objects - II

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo


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!

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998