HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 21 February 97

Foil 14 Creation of JavaScript Objects

From Feb 17/19 Delivered Lecture for Course CPS616 -- aJavaScript Language Objects and Frames CPS616 spring 1997 -- Feb 17 and 19 1997. by Geoffrey Fox * Important Information in IMAGE
Secs 256.3
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 Fri Feb 21 1997