By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

Gallery Help?

nritchie124
P: 1
Hi there....
I know some one out there will be able to figure this out....it just isn't me.
I'm a graphics guy and my java coding is very limited.

I'm trying to have a gallery with thumbs on the bottom, back and next buttons on top and the pic in the middle.

I have a swap that works nice for the thumbs and an array with back and next functions for the top buttons. I need them to work together or a single script to control all of it....
Ultimately i need the photos and captions to swap from both the thimbs and top buttons, in harmony...HELP!

Heres what i have so far...

[HTML]<script language="JavaScript" type="text/JavaScript">
<!-- This contros the thumbs... -->
function swapPhoto(photoSRC,theCaption) {
var displayedCaption = document.getElementById("caption");
displayedCaption.firstChild.nodeValue = theCaption;
document.images.imgPhoto.src = "images/realty/" + photoSRC;}
<!-- and for the back/next links... -->
var photos=new Array()
var which=0
photos[0]="images/realty/pic1.jpg"
photos[1]="images/realty/pic2.jpg"
photos[2]="images/realty/pic3.jpg"
photos[3]="images/realty/pic4.jpg"
photos[4]="images/realty/pic5.jpg"
function backward(){
if (which>0){
window.status=''
which--
document.images.imgPhoto.src=photos[which]
}
}
function forward(){
if (which<photos.length-1){
which++
document.images.imgPhoto.src=photos[which]
}
else window.status='End of gallery'
}
</script>
<!-- In the body of the html - for the main image... -->
<p><a href="javascript:backward()">&lt;&lt;Back</a> - <a href="javascript:forward()">Next&gt;&gt;</a></p>
<p><img src="images/realty/pic1.jpg" name="imgPhoto" id="imgPhoto" /></p>
<p id="caption">...</p>
<!-- and for the thumbs... -->
<a href="javascript:swapPhoto ('pic1.jpg','caption')"><img src="images/realty/t_pic1.jpg" alt="Thumbnail" width="40" height="40" border="0" /></a>
[/HTML]

Now everything works, but if i browse by thums then the back/next buttons are pooched and if i browse by b/n alone the captions don't load.

I'm sure there is an easy fix or a better way but like i said - I'm a graphics guy...

Thanks in advance - I know time is precious
Dec 3 '06 #1
Share this Question
Share on Google+
1 Reply


Ganon11
Expert 2.5K+
P: 3,652
Sorry to disappoint, but it looks like you need some help in javascript - this is the Java forum. Java and Javascript are two completely different things.

Try here: http://www.thescripts.com/forum/forum149.html
Dec 3 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.