Basic HTML version of Foils prepared 23 June 1997

Foil 27 User-defined Objects - I

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


1 You define a class template (to use Java lingo) with a function definition and then create an instance of the object with the new statement:
2 function MenuObject(no, name) {
3 this.no = no; // Give instance a numerical label
4 this.name = name; // Label this particular menu
5 this.color = 'black';
6 this.menuSelection = 1;
7 this.count = 0;
8 this.options = new Array(); // To be discussed
9 }
10 Define two menu instances:
11 worldMenu = new MenuObject(1, 'world');
12 familyMenu = new MenuObject(2, 'family');

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