
September 9th, 2002, 10:35 PM
|
|
|
|
Join Date: Apr 2007
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
slide show in javascript
i got this code from cnet to create a slideshow with javascript, is it possible to modify this code that when it reaches the last slide, instead of starting the show over, it moves on to another page??
The code in action can be viewed here:
http://builder.cnet.com/webbuilding/pages/Authoring/MoreStupid/ss07.html
Thanks for any help.
Code:
<script language="JavaScript1.2">
<!--
// Cross-browser cleanup by Paul Anderson, CNET Builder.com. All rights reserved.
var numSlides = 5;
var currentSlide = numSlides;
// remove the next six lines if you don't want captions:
var captionTxt = new Array(numSlides);
captionTxt[1] = "Entrance to Pier 39"
captionTxt[2] = "Sea lions lounging around the pier"
captionTxt[3] = "Boats docked on the pier"
captionTxt[4] = "Underwater World whale mural"
captionTxt[5] = "Alcatraz, or The Rock"
function setUp() {
if (!document.all) {
document.all = document;
for (i=1;i<=numSlides;i++) document.all[("image"+i)].style=document.all[("image"+i)];
}
switchSlide(1);
}
function switchSlide(sDir) {
newSlide = currentSlide + sDir;
if (!newSlide) newSlide=numSlides;
if (newSlide > numSlides) newSlide=1;
document.all[("image"+newSlide)].style.visibility="visible";
document.all[("image"+currentSlide)].style.visibility="hidden";
// remove the next line if you don't want captions:
document.all["captions"].document.forCaptions.captionsText.value=captionTx t[newSlide];
currentSlide = newSlide;
}
//-->
</script>
|