View Full Version : [DHTML] Rollover Images for Idiots

09-17-2006, 08:55 AM
1) CODE TITLE: Rollover Images for Idiots

2) AUTHOR NAME/NOTES: jscheuer1


This script will allow you to make a list of images to be available for rollovers. All that is required is that you give the image tag(s) that you want to have a rollover a class name of "r#" where the # is the number of the image that you want to show onmouseover.

It is meant to be very easy to use. It will preload your images automatically and add the onmouseover and onmouseout events to the image tag(s) for you, preserving virtually all existing events for those tags, if any.

It plays very well with other scripts as, it has only one global variable, two functions and its onload event is designed to append itself to others on the page in most cases.

The same rollover image may be assigned to multiple image tags, even if their original source images are different, without having to list the rollover image more than once or having to use a different class designation to initialize it.

Other class names may be used to style your images, as long as the r# class is the first class name listed.

4) URL TO CODE: http://home.comcast.net/~jscheuer1/side/rollo.htm

or, ATTACHED BELOW (see #3 in guidelines below):

09-17-2006, 07:53 PM
Nice. Though I prefer CSS.

09-18-2006, 05:10 AM
Nice. Though I prefer CSS.
You are obviously not an idiot then. :) The script is for folks that cannot be bothered to learn much about style, HTML, or scripting and who just want something to plug into their existing page. I think it is a big improvement over the mm_imageswap or whatever it's called that I've seen in use many places. It is the easiest rollover code to use that I've ever seen, and unlike many others like it, plays very well with other scripts and events.