---------------------------------------------------------------------- ---------------------------------------------------------------------- ---------------------------------------------------------------------- ---------------------------------------------------------------------- ---------------------------------------------------------------------- The following code is taken from the class "OptionX()" and is used to help explain the linking of images[] objects with the JS code objects that dynamically generate each images[] object. =================================================================== . . . document.write( ' ' + ' ' + label + '
' + '
' ); . . . Link an Object to its Dynamically Generated Image ================================================================ Let's say that we create a JavaScript code object using the syntax "optionX = new OptionX(...)". This writes HTML that creates an images[] object using the syntax as in the code above. We establish a link between the code object and the image as follows: this.image = document.images[n] where "this" refers to the JavaScript code object and ".image" is a pointer to the corresponding image, and where "n" is the number of the current image (for the first image, n = 0). Thus the variable "image" in the current object (in this case "optionX.image") points to the image in "document.images[n]" that you just created with the "" part in the formatted output above. A key point is that the word "this" refers to the code object that created the document.images[n] object. Link a Dynamically Generated Image to its Object ================================================================= The inverse process which lets the images[n] object activate the corresponding JavaScript object, is accomplished with the following statement: this.image.obj = this (where "this" means the current object) Since "this.image" is defined as "document.images[n]" above, we have the statement: this.image.obj = this means the same thing as document.images[n].obj = this which we might conceptually write as: (document.images[n]).obj = the associated OptionX() code object. So the fragment of the formatted output above: onMouseOver="document.images['+n+'].obj.over(); ..." really means onMouseOver="this.obj.over();..." Thus when we move the mouse over the image we have just generated, the function "over()" associated with the current object is activated.