Pass the mouse pointer over the text below to display graphics in a specific area. View source.

Blue Star
Gold Star
Green Star
Purple Star
Silver Star
Yellow Star
Blue Star
Gold Star
Green Star
Purple Star
Silver Star
Yellow Star

This simplified variation of example #3 was written by hand. It does not use the sophisticated object-property and programming features as would be inserted by Dreamweaver; however it is easier to understand. With JavaScript instructions located near the beginning in the </head> section of this Web page, a new instance of the image object is defined for the blank (solid white) square graphic and for each of the six colored stars. The source property (.src) for each image object instance is assigned the name of the file containing the respective image. For example:

In this example, the onMouseOver event-handlers call the "display_image" function and supply it with only one piece of information.

Instead of having the OnMouseOut event-handlers also call the "display_image" function and supply it with the literal image-file name containing the solid white image, I had them call a simpler function I named "reset_starspace", which simply restores the source property of the named image "starspace" to the file-name of the solid white square (starblnk.gif).

The onClick event-handlers simply return a value of false, when invoked. This prevents the page (href="#" link) from being loaded if the user clicks on a star name. (The onClick="return false;" is not a feature supplied by Dreamweaver.)

 

Return to Having Fun with JavaScript.