bmgamble.com
Home Web Design Portfolio Resume Software Development Contact Me

Custom Code

-Back-

Mouse Over Effect JavaScript
Date Added: May 19, 2003
Platforms: NS: all - IE: all
Author: Bryan Gamble (bryan@bmgamble.com)
Homepage: bmgamble.com
Description:
    Using simple javascript to make an effect, an image changes whenever a cursor is moved over it.
Example:

    To see how this script works, simply place your cursor over the image from the "Result". To copy the images, right click on the image and choose "Save Picture As" for both images.

    "test.gif"
    test.gif
    "MO_test.gif"
    MO_test.gif
    Result:
    Pictures
The Code:

    Cut and paste this code by pressing "highlight all":

    Cut and paste this code by pressing "highlight all":
Notes:
    First, you must create two separate images. I call the first image "test.gif" and the second, "MO_test.gif". Then I create two objects: "img1on" (MO_test.gif) and "img1off" (test.gif). When calling the function that switches the images, I pass it a variable according to the image number. Since it is the very first image, I pass it "0". If it were the second image, i would pass it a 1 and so on. If you would like to add more images, simply create more objects. . ."img2on", "img3on", and so on.

-Back-

home - web design - portfolio - resume - soft dev - contact me

Copyright 2003,2004 bmgamble.com all rights reserved