...

View Full Version : Help with JavaScript SlideShow



TrvlOrm
05-05-2004, 03:08 AM
HI There,

I have been struggling with JavaScript code for days now, and this is my last resort! Please help...send replies or futher information to ksorman@shaw.ca

I am trying to create a JavaScript slide show with links for Next Slide, Previous Slide and Home Slide.

Is it possible for you to view my page and tell me what I am doing wrong. I have looked at this page for hours and can't figure it out, I must be missing something or have something in the wrong order, but can't figure it out...please help....thanks...

I think I need someone to explain the EXACT code for this page as it would appear in the page so it displays correctly.

If you can figure this out, I have 2 more I need help with too...

Thanks so much, Much appreciated...but this is a URGENT request. Need a quick answer that will work!

Any ideas????

Here is my code:
<HTML>
<HEAD>
<TITLE>JavaScript Slide Show - PhotoAlbum</TITLE>

<SCRIPT LANGUAGE="JavaScript">

var PhotoAlbum = new
Array("bunny_lady.gif","business_lady.gif","running_lady.gif","color_lady.gif")
var PicIndex=1
var pictures=PhotoAlbum.length

function NextImage ( ) {
if (PicIndex < pictures) {
PicIndex++
}
document.ImgAlbum.src=PhotoAlbum[PicIndex-1]
}

function PreviousImage ( ) {
if (PicIndex > 1) {
PicIndex--
}
document.ImgAlbum.src=PhotoAlbum[PicIndex-1]
}

function home ( ) {
document.ImgAlbum.src=PhotoAlbum[0]
}


</SCRIPT>
</HEAD>

<BODY BACKGROUND=BACK02.jpg TEXT=Blue>

<CENTER>

<H1 ALIGN=Center> The Vacation Photo Album</H1><BR>
<H3 ALIGN=Center> Click on Previous or Next to view pictures in my Slide Show </H3><HR><HR>

<IMG SRC=bunny_purse.gif NAME= ImgAlbum Width=400 Height=270>
<BR>
<HR>
<A HREF="JavaScript:home ( ) ">[First Image]</A>
<A HREF="JavaScript:PreviousImage ( )">[Previous Image]</A>
<A HREF="JavaScript:NextImage ( )">[Next Image]</A>
</CENTER>

</BODY>
</HTML>

TrvlOrm
05-05-2004, 07:31 PM
Is there anyone out there who can help me with this please??????

Roy Sinclair
05-05-2004, 10:27 PM
When you ask this:



Please help...send replies or futher information to ksorman@shaw.ca


I automaticallly assume you have no intention of returning to the forum. So any response here would be useless. I also don't provide "personal" help, I reply to forum messages for people who are willing to work on the problem in the public forum, that way others who have similar problems can search for the problem and perhaps find the answers they need much more quickly than the typical "ask a question then get a reply" cycle allows.

A quick check of your page appears to work, are you sure you've got the right names and locations for your images (your initial image certainly doesn't match any of the other images)?

TrvlOrm
05-05-2004, 10:43 PM
Yes, I am open to discussion forums - I am new at this, so posting here is fine for replies. Thanks for letting me know.

I am sure all my images correspond, and can't get the next or previous image button to work.

Any other help much appreciated....

I do return quite often....



When you ask this:



I automaticallly assume you have no intention of returning to the forum. So any response here would be useless. I also don't provide "personal" help, I reply to forum messages for people who are willing to work on the problem in the public forum, that way others who have similar problems can search for the problem and perhaps find the answers they need much more quickly than the typical "ask a question then get a reply" cycle allows.

A quick check of your page appears to work, are you sure you've got the right names and locations for your images (your initial image certainly doesn't match any of the other images)?

TrvlOrm
05-05-2004, 10:49 PM
Ok, Images correspond.. But is there any way to add 2 or 3 more .gif images to the next button?



<HTML>
<HEAD>
<TITLE>JavaScript Slide Show - PhotoAlbum</TITLE>

<SCRIPT LANGUAGE="JavaScript">

var PhotoAlbum = new
Array("bunny_purse.gif","business_lady.gif","running_lady.gif","color_lady.gif")
var PicIndex=1
var pictures=PhotoAlbum.length

function NextImage ( ) {
if (PicIndex < pictures) {
PicIndex++
}
document.ImgAlbum.src=PhotoAlbum[PicIndex-1]
}

function PreviousImage ( ) {
if (PicIndex > 1) {
PicIndex--
}
document.ImgAlbum.src=PhotoAlbum[PicIndex-1]
}

function home ( ) {
document.ImgAlbum.src=PhotoAlbum[0]
}


</SCRIPT>
</HEAD>

<BODY BACKGROUND=BACK02.jpg TEXT=Blue>

<CENTER>

<H1 ALIGN=Center> The Vacation Photo Album</H1><BR>
<H3 ALIGN=Center> Click on Previous or Next to view pictures in my Slide Show </H3><HR><HR>

<IMG SRC=bunny_purse.gif NAME= ImgAlbum Width=400 Height=270>
<BR>
<HR>
<A HREF="JavaScript:home ( ) ">[First Image]</A>
<A HREF="JavaScript:PreviousImage ( )">[Previous Image]</A>
<A HREF="JavaScript:NextImage ( )">[Next Image]</A>
</CENTER>

</BODY>
</HTML>

Roy Sinclair
05-05-2004, 11:24 PM
You can add new pictures by adding them to the array you define here:



var PhotoAlbum = new Array("bunny_purse.gif","business_lady.gif","running_lady.gif","color_lady.gif","anewimage.gif")


I copied your page and renamed some gifs and the whole thing worked work me as is, you are placing those images in the same directory as the page aren't you?

TrvlOrm
05-06-2004, 01:05 AM
:thumbsup: Thank you So much, I got it to finally work...Boy that took a while, still don't know what I did wrong, but when I copied your code - it worked. That's all I needed it to do.,...thanks again.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum