HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 27 Creation of JavaScript Objects

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE

You define the Class template (to use a Java lingo) with a function definition
Then create an instance of the object with the new statement which acts as a constructor to initialize values
function MakeMenu(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(); // We will discuss this later
}
worldmenu = new MakeMenu(1,'world');
familymenu = new MakeMenu(2,'family'); // define two menu instances



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 Feb 19 1997