|
Line 15 - For the function to work it must be called when the user rolls over one of the designated images on the page. This is triggered by placing an onMouseOver event handler within the anchor tag of the image. When the image is rolled over, the function "ImageSwp" is called and two parameters are sent - The image name and the image source.
When the user moves their mouse away from the image the onMouseOut event handler is triggered. Once again this calls the "ImageSwp" function and the two parameters are sent - The image name and the image source.
The final item to be placed in the anchor tag is the usual 'img' tag, which contains the information for the image e.g. size and alignment

Roll over the image to see the script in action
That's it! The function can be reused for as many images in the
document as you like by copying line 15 and changing the image name
and source inside the anchor tag.
If you wish to learn more about JavaScript functions try looking
at the web sites on the links page, or
alternatively there is recommended reading on the sources
page.
|