Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rollover thumbnail question...

Status
Not open for further replies.

sumilsay

Technical User
Feb 12, 2003
69
CA
hello all,
i have some thumbnails that, when a user rolls over them, it goes from 50% opacity, to 100%. i have all the thumbnails made and everything, which is in this code...
Code:
<a href="javascript:changePic('kt01.jpg')"><img thumb_kt01.jpg" onMouseOver="javascript:rolled('thumb_kt01.jpg')"  onMouseOut="javascript:rolled('thumb_kt01.jpg')"name="thumb" id="thumb" alt="" /></a>	
<a href="javascript:changePic('kt02.jpg')"><img thumb_kt01.jpg" onMouseOver="javascript:rolled('thumb_kt02.jpg')"  onMouseOut="javascript:rolled('thumb_kt02.jpg')"name="thumb" id="thumb" alt="" /></a>
and i have this javascript to handle it...
Code:
function rolled(source){
	document.thumb.src=source;
}
it seems that this cannot happen because its going to try to change both pictures. i just cant think of a way that will change each one individually... can anyone assist me please.
do i even make sense?

thanks for your time everyone.
be happy.
AP.
 
Code:
function rolled(source)
{
  var imgs = document.getElementByName("thumb");
  if (!imgs)
    return;
  if (imgs.length == undefined)
  {
    imgs.src = source;
    return;
  }
  for (var i=0; i<imgs.length; i++)
    imgs[i].src = source;
}

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top