HighDots Forums  

rotating-images?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss rotating-images? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark M
 
Posts: n/a

Default rotating-images? - 07-04-2007 , 10:49 PM






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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.