// currentObject and view variables
// Analysis
var currentObject = -1;
var view = "objects";

This section of code creates the currentObject variable and the view variable. The currentObject variable is used by the move() function as an index to the object array. It is initially set to -1 because the script begins by showing the introduction page, which is not in the array. When the user presses either the previous or next buttons, the move function will automatically set the currentObject variable to 0, the index of the button object, and the first element of the object array.

The view variable is an important variable -- it is responsible for toggling betweent the object descriptions and the examples. Take a moment to browse the directory structure of these examples and you will see that there are two directories -- objects and examples -- and inside each of those directories are a series of directories named after the objects (button, check, form, etc). Inside each individual object directory are the documents needed by that example or description. The directory structure is key to the workings of this example. Notice how the paths to the button description and example are related:

(Path to button object description)
objects/button/button.htm

(Path to button object example)
examples/button/button.htm

This structure will be exploited by the move() function.

Close Window