View Full Version : Last link rolled over maintains picture (instead of switching back to default)

05-12-2009, 04:04 AM
I'd really appreciate any help!

I have a script that has several links and when you rollover the link it changes a main picture to be view as an image. But, when you no longer mouse over the link, it switches back to the default image.

I'd like for the last link that was rolled over to stay enlarged as the main pic until you roll over a different link.

Here's the current script...

In the head:

<SCRIPT TYPE="text/javascript">

// var image information object
var mloi=new Object();

// set the image for swapping
function setswap()
if (! document.images)return;
var imgInfo=new Object();
imgInfo.defaultImg = new Image();
imgInfo.defaultImg.src = document.images[arguments[0]].src;
imgInfo.opts = new Object();
for (var i=1; i < arguments.length; i=i+2)
imgInfo.opts[arguments[i]]=new Image();
imgInfo.opts[arguments[i]].src = arguments[i+1];
mloi[arguments[0]] = imgInfo;

// set up the link for swapping
function swap(link,imgName,optName)
if (! document.images)return;
if (! link.swapReady)
link.imgName = imgName;
link.onmouseout = swapBack;
link.swapReady = true;

function swapBack()


Displays the "main image"

<SCRIPT TYPE="text/javascript">
blue', 'blue.jpg',
'pink', 'pink.jpg',
'white', 'white.jpg'

Displays the link:

<a href="#" onMouseOver="swap(this,'showperson','blue')"></a>

Thanks again so much for any help!

05-12-2009, 08:57 AM
Remove this line:

link.onmouseout = swapBack;

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum