I'm trying to get this code to work three times so I tried changing the
variables and then in my html having
<img src="image_jss.gif" name="banner1">
<img src="image_jss.gif" name="banner2">
/* This script and many more are available free online at
The JavaScript Source ::
http://javascript.internet.com
Created by: Lee Underwood ::
http://javascript.internet.com/ */
var bannerImg1 = new Array();
// Enter the names of the images below
bannerImg1[0]="teaser/home_teaser_dental_ez1.gif";
bannerImg1[1]="teaser/home_teaser_dental_ez2.gif";
var newBanner1 = 0;
var totalBan1 = bannerImg1.length;
function cycleBan1() {
newBanner1++;
if (newBanner1 == totalBan1) {
newBanner1 = 0;
}
document.banner1.src=bannerImg1[newBanner1];
// set the time below for length of image display
// i.e., "4*1000" is 4 seconds
setTimeout("cycleBan1()", 2*1000);
}
window.onload=cycleBan1;
var bannerImg2 = new Array();
// Enter the names of the images below
bannerImg2[0]="teaser/home_teaser_rocky1.gif";
bannerImg2[1]="teaser/home_teaser_rocky2.gif";
bannerImg2[2]="teaser/home_teaser_rocky3.gif";
var newBanner2 = 0;
var totalBan2 = bannerImg2.length;
function cycleBan2() {
newBanner2++;
if (newBanner2 == totalBan2) {
newBanner2 = 0;
}
document.banner2.src=bannerImg2[newBanner2];
// set the time below for length of image display
// i.e., "4*1000" is 4 seconds
setTimeout("cycleBan2()", 2*1000);
}
window.onload=cycleBan2;
html code..
<img src="image_jss.gif" name="banner1">
<img src="image_jss.gif" name="banner2">
found the script here..
http://javascript.internet.com/image...ing-image.html
Any idea how to do this? Trying to have a few images on the same page
rotate.
Thanks,
Mark