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


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:
function MenuObject(no, name) {
this.no = no; // Give instance a numerical label
this.name = name; // Label this particular menu
this.color = 'black';
this.menuSelection = 1;
this.count = 0;
this.options = new Array(); // To be discussed
}
Define two menu instances:
worldMenu = new MenuObject(1, 'world');
familyMenu = new MenuObject(2, 'family');



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