Reply
Urgent Java Script Help Required!
Old 10-28-2007, 07:56 AM Urgent Java Script Help Required!
Junior Talker

Posts: 1
Name: Kevin
I have written a little website that is similar in style to an image gallery, what I need to do is when a thumbnail image is clicked, put the enlarged pic on the other side of the page (I've done this bit) but also under the bigger pic I would also like to put some descriptive text. how can I get this job done when the thumbnail is clicked?

what I have is a basic swapPhoto function.

function swapPhoto(photoSRC) {
document.images.imgPhoto.src = "" + photoSRC;

scrollTo(0,0);
}

and the link when clicked does this:

<a href="javascript:swapPhoto('exitmusic.jpg')"><img src="exitmusicsmall.jpg" border="0" /></a>


any help you can give me on this would be appreciated! thanks
antihero is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 10-28-2007, 12:33 PM Re: Urgent Java Script Help Required!
Insensus's Avatar
Ultra Talker

Posts: 275
Name: Mark Stegeman
Location: Netherlands, Europe
Make an array containing all the descriptions and an array containing all the image src's, like so:

var src = new Array('image1.jpg','image2.jpg','image3.jpg' etc...);
var desc = new Array('image 1','image 2','image 3' etc...);

Then change your swap function to this:

function swapPhoto(ID){
document.images.imgPhoto.src = src[ID];
document.images.description.innerHTML = desc[ID];

scrollTo(0,0);
}

and the link:

<a href="javascript:swapPhoto(1)"><img src="small.jpg" /></a>
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Urgent Java Script Help Required!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10986 seconds with 12 queries