Automatically Swapping Pictures

J

jack

I would like to create an element in a page in which a picture changes
automatically every 5 seconds or so (a loop of six pictures). How could I
accomplish this?
Thanks,
Jack
 
J

jack

Thanks for the reply, but I am afraid I did not adequately describe what I
am looking for. I would like to incorporate a spot on a page where I can
display a picture (that's the easy part). I would like to then have this
picture change every 5 seconds to a new picture, and create a loop of 6
total pictures. Thus, when the page is open, a portion of the display (the
picture) will continuously change. Thanks for any ideas...
Jack
 
S

Stefan B Rusynko

Go to the site http://www.chalcedony.com/javascript/scripts/index.html and look at the scripts in Chapter 5



| Thanks for the reply, but I am afraid I did not adequately describe what I
| am looking for. I would like to incorporate a spot on a page where I can
| display a picture (that's the easy part). I would like to then have this
| picture change every 5 seconds to a new picture, and create a loop of 6
| total pictures. Thus, when the page is open, a portion of the display (the
| picture) will continuously change. Thanks for any ideas...
| Jack
|
|
|
| | > an animated gif (?) or www.hotscripts.com or
| http://internet.javascript.com
| > should have an 'image rotator' script.
| >
| > | > > I would like to create an element in a page in which a picture changes
| > > automatically every 5 seconds or so (a loop of six pictures). How could
| I
| > > accomplish this?
| > > Thanks,
| > > Jack
| > >
| > >
| >
| >
|
|
 
A

Andrew Murray

Yes, you can do exactly as you're asking with the scriipts on the sites I
provided you just need to have a hunt around for a bit.

Frontpage itself has nothing close to that if that is what you were asking.

Try the script below.

Change the images in the indicated places to your image names and change the
paths to suit your system/web site.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: CodeLifter.com ([email protected]) -->
<!-- Web Site: http://www.codelifter.com -->
<!-- Begin
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'toad.jpg'
Pic[1] = 'lizard.jpg'
Pic[2] = 'chameleon.jpg'
Pic[3] = 'gecko.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
// End -->
</script>


</HEAD>

<BODY Background=../graphics/grayback.jpg onLoad="runSlideShow()">
<center><BR><BR>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="VU" height=190 width=330>
<img src="toad.jpg" name='SlideShow' width=330 height=190>
</td>
</tr>
</table>


</center>
</BODY>
</HTML>
 
J

JPKarlsen [FP MVP]

Here is one I altered slightly to include a few more options.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

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

<!-- Modyfied by Jens Peter Karlsen 2003 -->

<!-- Begin
NewImg = new Array (
"images/1.jpg",
"images/2.jpg",
"images/3.jpg"
);

var p = NewImg.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = NewImg;
}
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 3000;
var t;
var lock = false;
var run;
function chgImg(direction) {

if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}

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>

<body>
<img src="images/1.jpg" name="SlideShow" width="125" height="100">
<table>
<tr>
<td align="right"><a href="javascript:chgImg(-1)">Previous</a></td>
<td align="center"><a href="javascript:auto()">Auto/Stop</a></td>
<td align="left"><a href="javascript:chgImg(1)">Next</a></td>
</tr>
</table>

</body>

</html>


Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.


nntp://msnews.microsoft.com/microsoft.public.frontpage.client/<[email protected]>

Yes, you can do exactly as you're asking with the scriipts on the sites I
provided you just need to have a hunt around for a bit.

Frontpage itself has nothing close to that if that is what you were asking.

Try the script below.

Change the images in the indicated places to your image names and change the
paths to suit your system/web site.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: CodeLifter.com ([email protected]) -->
<!-- Web Site: http://www.codelifter.com -->
<!-- Begin
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'toad.jpg'
Pic[1] = 'lizard.jpg'
Pic[2] = 'chameleon.jpg'
Pic[3] = 'gecko.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
// End -->
</script>


</HEAD>

<BODY Background=../graphics/grayback.jpg onLoad="runSlideShow()">
<center><BR><BR>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="VU" height=190 width=330>
<img src="toad.jpg" name='SlideShow' width=330 height=190>
</td>
</tr>
</table>


</center>
</BODY>
</HTML>






jack said:
Thanks for the reply, but I am afraid I did not adequately describe what I
am looking for. I would like to incorporate a spot on a page where I can
display a picture (that's the easy part). I would like to then have this
picture change every 5 seconds to a new picture, and create a loop of 6
total pictures. Thus, when the page is open, a portion of the display (the
picture) will continuously change. Thanks for any ideas...
Jack



[microsoft.public.frontpage.client]
 
J

jack

Wow...thanks for the effort and responses from JPK, AM and SR...I appreciate
it, and I will post my page when completed....
Regards,
Jack


JPKarlsen said:
Here is one I altered slightly to include a few more options.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

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

<!-- Modyfied by Jens Peter Karlsen 2003 -->

<!-- Begin
NewImg = new Array (
"images/1.jpg",
"images/2.jpg",
"images/3.jpg"
);

var p = NewImg.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = NewImg;
}
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 3000;
var t;
var lock = false;
var run;
function chgImg(direction) {

if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuratio
n)";
document.images.SlideShow.filters.blendTrans.Apply();
}
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}

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>

<body>
<img src="images/1.jpg" name="SlideShow" width="125" height="100">
<table>
<tr>
<td align="right"><a href="javascript:chgImg(-1)">Previous</a></td>
<td align="center"><a href="javascript:auto()">Auto/Stop</a></td>
<td align="left"><a href="javascript:chgImg(1)">Next</a></td>
</tr>
</table>

</body>

</html>


Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

nntp://msnews.microsoft.com/microsoft.public.frontpage.client/ said:
Yes, you can do exactly as you're asking with the scriipts on the sites I
provided you just need to have a hunt around for a bit.

Frontpage itself has nothing close to that if that is what you were asking.

Try the script below.

Change the images in the indicated places to your image names and change the
paths to suit your system/web site.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK href="general.css" rel="stylesheet" type="text/css">

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: CodeLifter.com ([email protected]) -->
<!-- Web Site: http://www.codelifter.com -->
<!-- Begin
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'toad.jpg'
Pic[1] = 'lizard.jpg'
Pic[2] = 'chameleon.jpg'
Pic[3] = 'gecko.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuratio
n)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
// End -->
</script>


</HEAD>

<BODY Background=../graphics/grayback.jpg onLoad="runSlideShow()">
<center><BR><BR>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="VU" height=190 width=330>
<img src="toad.jpg" name='SlideShow' width=330 height=190>
</td>
</tr>
</table>


</center>
</BODY>
</HTML>






jack said:
Thanks for the reply, but I am afraid I did not adequately describe what I
am looking for. I would like to incorporate a spot on a page where I can
display a picture (that's the easy part). I would like to then have this
picture change every 5 seconds to a new picture, and create a loop of 6
total pictures. Thus, when the page is open, a portion of the display (the
picture) will continuously change. Thanks for any ideas...
Jack



could
I



[microsoft.public.frontpage.client]
 
Top