Hello everybody, I am a noob trying to teach himself javascript. Currently, I am trying to do some image rotation with 4 gifs. The book I purchased shows how to rotate only two images. I got two images to work, but when I tried three it does not work properly. I am not sure what I am doing wrong. Any help would be greatly appreciated. Here is the code I have:
<script language=”JavaScript” type=”text/javascript”>
<!–
window.defaultStatus = “Welcome to my banner ads!!”;
function showAnimals(linkTarget){
animalWindow = window.open(linkTarget, “animalInfo”, “toolbar=no,menubar=no,scrollbars=no,resizable=no,width=370,height=75”);
}
var curImage=”adImage1″;
var changeImages;
function safariAd(){
if(curImage == “adImage2”){
document.images[0].src=”adImage1.gif”; curImage=”adImage1″;
}
else{
document.images[0].src=”adImage2.gif”; curImage=”adImage2″;
}
if(curImage == “adImage2”){
document.images[0].src=”adImage2.gif”; curImage=”adImage2″;
}
else{
document.images[0].src=”adImage3.gif”; curImage=”adImage3″;
}
}
//–>
</script>
</head>
<body onload=”var changeImages=setInterval(‘safariAd()’,1000);”>
<img src=”adImage1.gif” height=”75″ width=”370″ alt=”My Banner Ad” /><br />