PDA

View Full Version : Changing Images within HTML.


Meths
11-24-2003, 03:19 AM
I’ve got a page with three thumbnail images (A, B & C) with a larger Jpg of A displayed above them.

Is there any way to change the Top Picture from A to B or C by clicking on the thumbnail images (without reloading the whole page or using an inline frame)?

Thanks

glenmac
11-24-2003, 05:52 AM
You can use layers for each of the pictures with attribute hidden then use an onclick handler to show each of the layers. You will have to use javascript to write a function to achieve this. I would post my question in the javascript forum.

r0ck1t
11-24-2003, 05:52 AM
Javascript would be your answer. Using element id's and innerHTML I would guess.

Something like:

<div id="img"></div>

<a href="#" onclick="javascript:document.getElementById("img").innerHTML = "<img src="path_to_image.jpg">"><img src="path_to_thumbnail.jpg" /></a>

That might work, but I can't give you much better cause me and JavaScript are strangers.

glenmac
11-24-2003, 06:21 AM
this may ba what you need.
http://www.jsmadeeasy.com/javascripts/DHMTL%20Miscelanious/DHTML%20Script%20-%20ShowHide/index.htm
Hope this helps.

adios
11-24-2003, 09:19 AM
http://simplythebest.net/info/javascript66.html

Meths
11-24-2003, 10:11 PM
Cheers guys,

the simplythebest script is exactly what I need