Main Page | Session 12 Index | Operator Precedence | Interactive Forms
Rollovers refer to the process of changing the appearance of some part of the page, usually buttons, when the mouse pointer "rolls over" a specific area or location.
This is accomplished using the folowing JavaScript features:
First, define two new Image objects to hold the images using:
Then assign the images to the "src" properties of these image objects:
Next, create a function which receives to values as parameters, one providing the name of the HTML image to change (to create a reusable function), and one value which indicates which image to display. See the example code below for the actual JavaScript code used for this example.
Write the HTML code for an image which is a link in order to use the onMouseOver and onMouseOut events of the anchor (link), also shown below. The key with the image is to provide it with a NAME which can be referenced by the JavaScript.
Sample JavaScript code:
Main Page | Session 12 Index | Operator Precedence | Interactive Forms