-I was asked to design a sample page of my work as a contruction business is looking for someone to make their web page. On the web page I was asked to put in 2 seperate banners of pictures of houses they have built all cycling through the different pics (banner one cycles through houses 1-7; banner two cycles through houses 8-14). The problem is, with my code I am only able to make one banner cycle.
![:tazz:](https://www.geekstogo.com/forum/public/style_emoticons/default/whistling.gif)
Here's my code:
<HTML>
<HEAD>
<TITLE> Cycling Banner Practice</TITLE>
<BODY>
<script>
imgArray = new Array(7);
imgArray[0] = new Image;
imgArray[0].src = "house1.jpg";
imgArray[1] = new Image;
imgArray[1].src = "house2.jpg";
imgArray[2] = new Image
imgArray[2].src = "house3.jpg";
imgArray[3] = new Image
imgArray[3].src = "house4.jpg";
imgArray[4] = new Image
imgArray[4].src = "house5.jpg";
imgArray[5] = new Image
imgArray[5].src = "house6.jpg";
imgArray[6] = new Image
imgArray[6].src = "house7.jpg";
index = 0;
function cycle ()
{
document.banner.src = imgArray[index].src;
index++;
if (index == 7)
{
index = 0;
}
setTimeout("cycle()",1000);
return;
}
</script>
<HEAD>
<BODY onLoad = "cycle();">
<CENTER>
<IMG SRC = "house1.jpg"
NAME = "banner"
WIDTH = 250
HEIGHT = 250>
</CENTER>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> Cycling Banner Practice</TITLE>
<BODY>
<script>
imgArray = new Array(7);
imgArray[0] = new Image;
imgArray[0].src = "house8.jpg";
imgArray[1] = new Image;
imgArray[1].src = "house9.jpg";
imgArray[2] = new Image
imgArray[2].src = "house10.jpg";
imgArray[3] = new Image
imgArray[3].src = "house11.jpg";
imgArray[4] = new Image
imgArray[4].src = "house12.jpg";
imgArray[5] = new Image
imgArray[5].src = "house13.jpg";
imgArray[6] = new Image
imgArray[6].src = "house14.jpg";
index = 0;
function cycle ()
{
document.banner.src = imgArray[index].src;
index++;
if (index == 7)
{
index = 0;
}
setTimeout("cycle()",1000);
return;
}
</script>
<HEAD>
<BODY onLoad = "cycle();">
<CENTER>
<IMG SRC = "house8.jpg"
NAME = "banner"
WIDTH = 250
HEIGHT = 250>
</CENTER>
</BODY>
</HTML>
Thanks alot for any help, I appreciate it.
Edited by boob, 01 June 2005 - 03:01 PM.