/    Sign up×
Community /Pin to ProfileBookmark

have image rotation problems need help

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 />

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @fixaflap73 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...