Hi, new to this website but I am just not getting what I am doing wrong on this. The assignment is that the page should have a cycling banner on the top third of the page, a random image banner in the middle third and a javascript slideshow on the bottom 3rd. Here is what I have...and individually the banners work fine but when I put them all together in one html file and only the last one works right. Any help is greatly appreciated...I am just not understanding this.
<html>
<head>
<title>HTML and Javascript</title>
<script>
var my_imgs = new Array(4);
var index = 0;
function cycle()
{
document.banner1.src = my_imgs[index].src;
index++;
if (index > 3)
{
index =0;
}
setTimeout("cycle()", 2000);
return;
}
function startup()
{
my_imgs[0] = new Image;
my_imgs[0].src = "lions.gif";
my_imgs[1] = new Image;
my_imgs[1].src = "tigers.gif";
my_imgs[2] = new Image;
my_imgs[2].src = "bears.gif";
my_imgs[3] = new Image;
my_imgs[3].src = "ohmy.gif";
cycle();
return;
}
var img_arr = new Array(4);
var index = 0;
function select ()
{
index = Math.floor(Math.random() * 4);
document.random.src = img_arr[index].src;
setTimeout("select()", 2000);
return;
}
function startup()
{
img_arr[0] = new Image;
img_arr[0].src = "lions.gif";
img_arr[1] = new Image;
img_arr[1].src = "tigers.gif";
img_arr[2] = new Image;
img_arr[2].src = "bears.gif";
img_arr[3] = new Image;
img_arr[3].src = "ohmy.gif";
select();
return;
}
var imgArray = new Array(4);
var index = 0;
function doBack()
{
if (index > 0)
{
index--;
document.slideshow.src = imgArray[index].src;
}
return;
}
function doNext()
{
if (index < 3)
{
index++;
document.slideshow.src = imgArray[index].src;
}
return;
}
function startup()
{
imgArray[0] = new Image;
imgArray[0].src = "lions.gif";
imgArray[1] = new Image;
imgArray[1].src = "tigers.gif";
imgArray[2] = new Image;
imgArray[2].src = "bears.gif";
imgArray[3] = new Image;
imgArray[3].src = "ohmy.gif";
return;
}
</script>
</head>
</body>
<body onLoad="startup()">
<div align="center">
<img name="banner1" src="lions.gif">
</div>
<p>
</p>
<body onLoad="startup()">
<div align="center">
<img name="random" src="lions.gif">
</div>
<p>
</p>
<body onLoad="startup()">
<div align="center">
<h2>My Javascript Slideshow</h2>
<p>
<img name="slideshow" src="lions.gif">
</p>
<p>
<a href="java script:doBack()">Back</a>
<a href="java script:doNext()">Next</a>
</p>
</div>
</body>
</html>


