View Full Version : Suggestion: Use Mouseover? Tables? Looking for a simple fix.

J.L. Orozco
07-13-2004, 06:13 PM

Referring to the image above:

What I'd like to do is have the image (Pepsi-like symbol) change when the
mouse is placed over various links (shown). I'm sure there are several different ways of pulling this off, but I'd like to know what first comes to mind for the experts.


07-13-2004, 09:32 PM
Give the image an ID.

<img id="main_img" src="pepsi.jpg"/>

Create an image swap function as follows:

function imageSwap(imgId, imgSrc) {
var img = document.getElementById(imgId);
img.src = imgSrc;

Then call this function onmouseover and onmouseout of the links:

<a href="http://www.google.com" onmouseover="imageSwap('main_img','img1.jpg');" onmouseout="imageSwap('main_img','pepsi.jpg');">Link 1</a>

That's what I would do.....

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum