Change Image 2
General
Use this script to change an image, using the setAttribute function. You can use different events to change the image, e.g., onClick, or onMouseOver. The script can also be adapted to other uses.
[Click the picture above to see the mountains]
Notes
- Created by: Yakor
- Posted: December 26, 2007
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: changeImage2.js
Head
Paste this code into the HEAD section of your HTML document.
Body
Paste this code into the BODY section of your HTML document


Leave a Response
(6 comments)In order to better help you, you'll need to post your question [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]over on the forums[/a].
i think this code may not work in ruby onrail context.i implimented it .it does not work.can any body help me while clicking on the image another image will come and viceversa.
You can either change it (see out tutorials section for help), or use another script.
Thanks Yakor for this script this very eyecatching script.keep it up. we all need good coder like you *BEST OF LUCK FOR YOUR WORK*
I think this is good but I would like the image to change randomly every time the page loads. There's no information for here about how to customize the script for people that don't know javascript.