Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript slideshow help, please.

Status
Not open for further replies.

webchick88

Technical User
Nov 4, 2007
1
US
I need to know how to get the captions to show in the textarea, for some reason it comes up saying the captions are "undefined".

Link:
Code used:
Code:
<html>
<head>
 <title></title>
<STYLE type="text/css">
<!-- .slides {position:absolute; left: 50%; top:50; visibility:hidden} -->
</STYLE> 
<SCRIPT language="JavaScript1.2">
var numSlides = 30;
var currentSlide = numSlides;
var captionTxt = new Array(numSlides);

function setUpCaptions() {
captionTxt[1] = "1 of 30"
captionTxt[2] = "2 of 30"
captionTxt[3] = "3 of 30"
captionTxt[4] = "4 of 30"
captionTxt[5] = "5 of 30"
captionTxt[6] = "6 of 30"
captionTxt[7] = "7 of 30"
captionTxt[8] = "8 of 30"
captionTxt[9] = "9 of 30"
captionTxt[10] = "10 of 30"
captionTxt[11] = "11 of 30"
captionTxt[12] = "12 of 30"
captionTxt[13] = "13 of 30"
captionTxt[14] = "14 of 30"
captionTxt[15] = "15 of 30"
captionTxt[16] = "16 of 30"
captionTxt[17] = "17 of 30"
captionTxt[18] = "18 of 30"
captionTxt[19] = "19 of 30"
captionTxt[20] = "20 of 30"
captionTxt[21] = "21 of 30"
captionTxt[22] = "22 of 30"
captionTxt[23] = "23 of 30"
captionTxt[24] = "24 of 30"
captionTxt[25] = "25 of 30"
captionTxt[26] = "26 of 30"
captionTxt[27] = "27 of 30"
captionTxt[28] = "28 of 30"
captionTxt[29] = "29 of 30"
captionTxt[30] = "30 of 30"
} 
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=captionTxt[newSlide];
currentSlide = newSlide;
}

//-->
</script> 
</head>


<BODY onLoad="setUp()">
<B>slide show</B>
<DIV id="image30" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image030.jpg"></DIV>[/URL]
<DIV id="image29" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image029.jpg"></DIV>[/URL]
<DIV id="image28" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image028.jpg"></DIV>[/URL]
<DIV id="image27" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image027.jpg"></DIV>[/URL]
<DIV id="image26" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image026.jpg"></DIV>[/URL]
<DIV id="image25" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image025.jpg"></DIV>[/URL]
<DIV id="image24" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image024.jpg"></DIV>[/URL]
<DIV id="image23" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image023.jpg"></DIV>[/URL]
<DIV id="image22" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image022.jpg"></DIV>[/URL]
<DIV id="image21" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image021.jpg"></DIV>[/URL]
<DIV id="image20" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image020.jpg"></DIV>[/URL]
<DIV id="image19" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image019.jpg"></DIV>[/URL]
<DIV id="image18" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image018.jpg"></DIV>[/URL]
<DIV id="image17" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image017.jpg"></DIV>[/URL]
<DIV id="image16" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image016.jpg"></DIV>[/URL]
<DIV id="image15" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image015.jpg"></DIV>[/URL]
<DIV id="image14" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image014.jpg"></DIV>[/URL]
<DIV id="image13" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image013.jpg"></DIV>[/URL]
<DIV id="image12" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image012.jpg"></DIV>[/URL]
<DIV id="image11" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image011.jpg"></DIV>[/URL]
<DIV id="image10" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image010.jpg"></DIV>[/URL]
<DIV id="image9" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image09.jpg"></DIV>[/URL]
<DIV id="image8" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image08.jpg"></DIV>[/URL]
<DIV id="image7" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image07.jpg"></DIV>[/URL]
<DIV id="image6" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image06.jpg"></DIV>[/URL]
<DIV id="image5" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image05.jpg"></DIV>[/URL]
<DIV id="image4" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image04.jpg"></DIV>[/URL]
<DIV id="image3" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image03.jpg"></DIV>[/URL]
<DIV id="image2" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image02.jpg"></DIV>[/URL]
<DIV id="image1" class="slides"><IMG src="[URL unfurl="true"]http://www.paintingsbygrafton.com/images/image01.jpg"></DIV>[/URL]
<DIV style="position:absolute; top:675px; left:50%">
<A href="javascript:switchSlide(-1)"><IMG src="previous.gif" border=0></A>
<A href="javascript:switchSlide(1)"><IMG src="next.gif" border=0></A>
</DIV> 
<DIV id="captions" style="position:absolute; left: 50%; top:490px">
<B>Picture caption</B>
<FORM name=forCaptions>
<TEXTAREA name="captionsText" wrap="virtual" rows=8 cols=15"></TEXTAREA>
</FORM>
</DIV>

</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top