/    Sign up×
Community /Pin to ProfileBookmark

Help with slideshow.need some more functions.PLEASE HELP!

Help with slideshow.need some more funtions.PLEASE HELP!
Here is my code, it works great, but i want to add more functions.
I want to add a Slide counter,like this “Slide: 10/15”.

[code]<SCRIPT LANGUAGE=”JavaScript”>
<!– Original: Mike Canonigo ([email protected]) –>
<!– Web Site: http://www.munkeehead.com –>

<!– This script and many more are available free online at –>
<!– The JavaScript Source!! http://javascript.internet.com –>

<!– Begin
NewImg = new Array (
“pic1.jpg”,
“pic2.jpg”,
“pic3.jpg”

);
var ImgNum = 0;
var ImgLength = NewImg.length – 1;

//Time delay between Slides in milliseconds
var delay = 3000;

var lock = false;
var run;
function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
document.slideshow.src = NewImg[ImgNum];
}
}
function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
run = setInterval(“chgImg(1)”, delay);
}
}
// End –>
</script>

</HEAD>

<!– STEP TWO: Copy this code into the BODY of your HTML document –>

<BODY>

<img src=”http://i4.photobucket.com/albums/y112/fob1k/P1020267.jpg” name=”slideshow” width=700 height=550>
<table>
<tr>
<td align=”right”><input type=”button” value=”Previous” onClick=”javascript:chgImg(-1)” /></td>
<td align=”center”><input type=”button” value=”Auto/Stop” onClick=”javascript:auto()” /><td>
<td align=”left”><input type=”button” value=”Next” onClick=”javascript:chgImg(1)” /></td>
</tr>
</table>
[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsJun 14.2006 — [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
</head>

<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Mike Canonigo ([email protected]) -->
<!-- Web Site: http://www.munkeehead.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
NewImg = new Array (
"http://www.vicsjavascripts.org.uk/StdImages/One.gif",
"http://www.vicsjavascripts.org.uk/StdImages/Two.gif",
"http://www.vicsjavascripts.org.uk/StdImages/Three.gif"

);
var ImgNum = 0;
var ImgLength = NewImg.length;

//Time delay between Slides in milliseconds
var delay = 3000;

var lock = false;
var run;
function chgImg(direction,stp) {
if (!stp){ clearInterval(run); lock = false; }
ImgNum = ImgNum + direction;
if (ImgNum == ImgLength){ImgNum = 0;}
if (ImgNum < 0) {ImgNum = ImgLength-1; }
document.getElementById('slideshow').src = NewImg[ImgNum];
document.getElementById('display').innerHTML ='Image '+(ImgNum+1)+' of '+ImgLength+' Images';

}

function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
chgImg(1,true)
run = setInterval("chgImg(1,true)", delay);
}
}
// End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<img src="http://i4.photobucket.com/albums/y112/fob1k/P1020267.jpg" id="slideshow" width=700 height=550>
<table>
<tr>
<td align="right"><input type="button" value="Previous" onClick="javascript:chgImg(-1)" /></td>
<td align="center"><input type="button" value="Auto/Stop" onClick="javascript:auto()" /><td>
<td align="left"><input type="button" value="Next" onClick="javascript:chgImg(1)" /></td>
<td align="left" id="display" ></td>
</tr>
</table>
</body>

</html>[/CODE]
Copy linkTweet thisAlerts:
@fob1kauthorJun 14.2006 — not working..please help
Copy linkTweet thisAlerts:
@fob1kauthorJun 14.2006 — Thanks..it works now..but how i change the font or size of the text-"Image x of x Images"
Copy linkTweet thisAlerts:
@vwphillipsJun 15.2006 — <td align="left" id="display" style="font-size:20px;" ></td>
×

Success!

Help @fob1k 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.17,
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,
)...