I'm trying to get this banner ad to rotate every 5 seconds. I'm obviously not doing something right, but can't figure out what it is that I'm messing up. Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<title>Case Projects 4-2 and 4-3</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
//////////////////function declarations
var curImage="adImage1";
var changeImages;
function ads() {
if (curImage == "adImage2") {
document.images[0].src = "adImage1.gif";
curImage = "adImage2";
}
if (curImage == "adImage3") {
document.images[0].src = "adImage2.gif";
curImage = "adImage3";
}
if (curImage == "adImage4") {
document.images[0].src = "adImage3.gif";
curImage = "adImage4";
}
if (curImage == "adImage5") {
document.images[0].src = "adImage4.gif";
curImage = "adImage5";
}
if (curImage == "adImage6") {
document.images[0].src = "adImage5.gif";
curImage = "adImage6";
}
}
function home1() {
document.images[1].src = "home1.gif";
}
function home2() {
document.images[1].src = "home2.gif";
}
function faq1() {
document.images[2].src = "faq1.gif";
}
function faq2() {
document.images[2].src = "faq2.gif";
}
function guestbook1() {
document.images[3].src = "guestbook1.gif";
}
function guestbook2() {
document.images[3].src = "guestbook2.gif";
}
function join1() {
document.images[4].src = "join1.gif";
}
function join2() {
document.images[4].src = "join2.gif";
}
//STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body onload="var changeImages=setInterval('ads()',5000);">
<p><div align="center"><img src="adImage1.gif"/></div></p><br /><br />
<p>
<a href="home.html"><img src="home1.gif" border="0" onmouseover="home2();" onmouseout="home1();"></a><br />
<a href="faqs.html"><img src="faq1.gif" border="0" onmouseover="faq2();" onmouseout="faq1();"></a><br />
<a href="guestbook.html"><img src="guestbook1.gif" border="0" onmouseover="guestbook2();" onmouseout="guestbook1();"></a><br />
<a href="join.html"><img src="join1.gif" border="0" onmouseover="join2();" onmouseout="join1();"></a></p>
</body>
</html>