[COLOR=#000000]Hello,[COLOR=#ff0000]
I snarfed a java script online that did as advertised: Allowed pics to be displayed in a rotating manner based on a time
value you set in the script. I don’t know if I can attach the script (this is my first time trying) so I will paste it here. It’s fairly
short. I’ve done a little bit of C and PHP programming, but I am a weekend warrior. Looking for a pro to help out. Here goes:
[COLOR=#0000cd]var bannerImg = new Array();
// Enter the names of the images below
bannerImg[0]=”/images/cover one.png”;
bannerImg[1]=”/images/cover two.png”;
bannerImg[2]=”/images/cover three.png”;
var newBanner = 0;
var totalBan = bannerImg.length;
[COLOR=#0000cd]function cycleBan() {
newBanner++;
if (newBanner == totalBan) {
newBanner = 0;
}
document.banner.src=bannerImg[newBanner];
// set the time below for length of image display
// i.e., “4*1000″ is 4 seconds
setTimeout(“cycleBan()”, 4
}
window.onload=cycleBan;
Most of it seems pretty straight forward:
1) create an array then stuff your pics in it.
2) set a couple of variables, one that equals 0 and the other the length of the array
3) create a function and begin it with ‘For Loop’ with a counter so you don’t count past the length of the array (all very C’ish so far)
The next line starts to get a little weird for someone who doesn’t work with javascript. It’s assigning [COLOR=#0000cd]document.banner.src [COLOR=#000000]equal to what’s in the zero position of the array. Then it wait’s for 4 seconds and exits the function. Then the line [COLOR=#0000cd]window.onload=cycleBan;
But what really weirds me out is what I have to put in the cell to make it all work:
[COLOR=#0000cd]<TD width=342 height=410 border=0 valign=top align=center><img src=”image_jss.gif” name=”banner”border=0><TD>[COLOR=#000000]
Img src=”image_jss.gif” what’s that all about? I mean, it works and all, put my pics are .png and you have to have name=banner too or it won’t work. Anyway, Is there a way that when one of the pics is displayed on the webpage a link can be assigned to it? then when the pic changes, a different link can be assigned? And so on? I could have asked all this without going through the code, but I thought it would be a good chance to learn a little more about how javascript works.
much appreciated,
Matt
[COLOR=#000000][COLOR=#000000]