View Full Version : Text appears when clicking on image

03-15-2006, 12:59 AM
Hi there. I would really appreciate some help.

I have an image gallery already set up.
However, when someone clicks on the thumbnail I would like to have the title of the image appear under the enlarged version. It is just your normal run of the mill gallery viewer (http://www.a-p-s.org.au/edidgallery1.html)

At present I have the names of the images permanently there, but I would prefer to remove that and just have the names appear when the image is displayed.

Thank you. :o

03-16-2006, 05:56 AM
OK, change your doPic() function to:

function doPic(imgName, theText) {
if (ns3up || ie4up) {
imgOn = ("" + imgName);
document.mainpic.src = imgOn;
if (document.getElementById&&typeof theText!=='undefined')
else if (document.getElementById)

Change the 'landing area' HTML to:

<td colspan="5"><img src="images/writing.gif" name="mainpic" id="mainpic"/><div id="maintext" style="text-align:center;font-size:.75em;margin-top:3px;"></div></td>

Use this type of syntax for the thumbnail links (this is an actual working example for your first thumbnail):

<a href="images/ediddiv/1/large/d1.jpg" onclick="doPic(this.href, '“Golden Hills#1”<br /><span class=\'hilite\'>Anne Specht</span>');return false;"><img src="images/ediddiv/1/thumbs/d1.jpg" alt="At The End" border=0 /></a>

Notes: doPic() now accepts two parameters. doPic(imgName, theText). You can still use your old thumbnail links as doPic() will detect if there is no text and display none in those cases. I switched the image to the href attribute so that non-javascript enabled browsers will be able to see the large image loaded into the window and can use their back button to return to the gallery.

03-17-2006, 12:21 AM
Thank you for this however I would prefer that the gallery stay on the same page rather than having to go to another window.:)
With the help of another guru I now have this:


However it does not work in Mozilla and I wouldn't have a clue with Mac users.

The other guru has seemed to have disappeared, do you have any more ideas?
Thanks again.

03-17-2006, 03:31 AM
Thank you for this however I would prefer that the gallery stay on the same page rather than having to go to another window.:)

I think you misunderstand. The gallery cannot remain on the same page without javascript and still show the larger images. That would be a rare case though. Generally, it will be the same as what you have now, just with captions for the large images. Try the code, I think (if you install it correctly) you will like it. It worked locally with an exact copy of your page on my computer in IE, FF and Opera. If you have problems, let me know, I can put up a demo for you and, if you publish your work in progress to the web, I can troubleshoot it if need be.

03-17-2006, 04:07 AM
Thanks for your help. I really appreciate it.:)