/    Sign up×
Community /Pin to ProfileBookmark

Help with captions in slideshow

I successfully created a slideshow format but need to add quite a bit of text as a caption to each image. I’m at a loss for how to do so and attempts to incorporate snippets from other codes online have failed. I’m a Javascript novice and any help would be greatly appreciated. Thanks very much. Here’s what I have:

<html>
<body>
<script language=”Javascript”>

var myPix = new Array(1,2,3)
var thisPic = 0
function previous() {

thisPic –;

if (thisPic < 0) {

thisPic = 2;

}

document.myPicture.src = “/images/buyingselling/20050711-retreats-” + myPix[thisPic] + “.jpg”;

}

function next() {

thisPic ++;

if (thisPic > 2) {

thisPic = 0;

}

document.myPicture.src = “/images/buyingselling/20050711-retreats-” + myPix[thisPic] + “.jpg”;

}

</script>
<p>

<p>
Intro text goes here</p>

</p>

</p>

</p>
<div style=”width:315px;”>
<p align=”center”>
<font face=”Arial” size=”2″>
<a href=”javascript:previous()”>&lt; Previous</a> |
<a href=”javascript:next()”>Next &gt;</a> </font>
</p>

<p style=”text-align:center;”>

<img border=”0″ src=”/images/buyingselling/20050711-retreats-1.jpg” width=”315″ height=”600″ name=”myPicture”>

</p>
<p>Default image caption text</p>
<p style=”text-align:center;”>
<font face=”Arial” size=”2″>
<a href=”javascript:previous()”>&lt; Previous</a> |
<a href=”javascript:next()”>Next &gt;</a> </font>
</p>
</div>

</body>

</html>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJul 11.2005 — Please try the following

[code=php]<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<script type="text/javascript">
<!--
var myPix = new Array()
myPix[0] = new Array(1,"picture 1")
myPix[1] = new Array(2,"image 2")
myPix[2] = new Array(3,"photo 3")

var thisPic = 0

function next(n) {

if(n==0){thisPic --}
if(n==1){thisPic++}

if (thisPic < 0) {thisPic = myPix.length-1}
if (thisPic > myPix.length-1) {thisPic = 0}

document.myPicture.src = "/images/buyingselling/20050711-retreats-" + myPix[thisPic][0] + ".jpg";

document.getElementById("display").innerHTML=myPix[thisPic][1]
}

//-->
</script>
</HEAD>
<BODY>

<p>Intro text goes here</p>

<div style="width:315px; text-align:center; font-family:arial; font-size:12px">
<a href="#null" onclick="next(0)">&lt; Previous</a> | <a href="#null" onclick="next(1)">Next &gt;</a>
<BR><BR>
<img border="0" src="/images/buyingselling/20050711-retreats-1.jpg" width="315" height="600" name="myPicture">

<div id="display">Default image caption text</div>
<a href="#null" onclick="next(0)">&lt; Previous</a> | <a href="#null" onclick="next(1)">Next &gt;</a>
</div>

</BODY>
</HTML>[/code]
Copy linkTweet thisAlerts:
@MB02authorJul 12.2005 — Thanks very much!!
×

Success!

Help @MB02 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...