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!

Image swaping

Status
Not open for further replies.

LKB6

MIS
Mar 20, 2009
23
US
I have a table where I inserted one large picture, and I also have 4 small thumbnails.

I found a few codes that allow to swap the large picture using javascript, but is there any code that will allow me to only use a mouseover to change/swap the large picture when I go over the thumbnails.

I couldn't finf anything like that.
Any help would be appreciated.
Thanks.
 
If you give the large picture an ID, for example 'largePicture', then you can set its SRC on mouse over of another image like this:

Code:
<img src="whatever.jpg" onmouseover="document.getElementById('largePicture').src = 'whatever_else.jpg';" />

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Simple and it works like a charm without using Javascript.
Thanks.
Louis
 
I used the 'BillyRayPreachersSon ' solution.
Therefore I didn't do much more that what he wrote.
Just added id='largepict' in the img scr tag.

and used the code he gave me.
Very simple, and works perfectly.

I have a javascript solution, but more code and not so easy to implement in my code that get info from an external database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top