Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 1
Name: Kevin
Trades: 0
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
 
 
Register now for full access!
Old 10-28-2007, 01:33 PM Re: Urgent Java Script Help Required!
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.09909 seconds with 12 queries