29 Aug
Javascript Image Swap
This code has proven to be useful many times in the last few weeks. Clients come to me asking for different type of “galleries” for their images. This is the standard code that I use:
Step 1: Choose the image / space that will change, to display different images. You need to use a name tag inside of this image tag.
<img src=”images/1.jpg” name=”MainImage”>
Step 2: Setup your links. Each link needs to have an onClick tag. You can setup as many links as you like. You can also use thumbnails of the images as the links, since you may not want to use text.
<a href=”#” onClick=”document.MainImage.src=’images/2.jpg’;”>Click Here</a>
I will post a link, once I have a working example for one of my clients.
