This simple image rotator javascript isn't working -can anyone find an error?

<script type="text/javascript"><!--
var imgs5 = new Array(
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-2-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-4-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-5-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-6-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-7-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-8-final.jpg");

var lnks5 = new Array(
"http://www.pressroomgraphics.com.au/machines/uv-varnish/1600-uv-vanishing-machine/",
"http://www.pressroomgraphics.com.au/machines/guillotines/touch-screen-double-hydraulic-double-guide-guillotine/",
"http://www.pressroomgraphics.com.au/machines/guillotines/480mm-guillotine/",
"http://www.pressroomgraphics.com.au/machines/guillotines/qzk1370/",
"http://www.pressroomgraphics.com.au/inks/",
"http://www.pressroomgraphics.com.au/machines/diecutting-creasing/auto-folder-creaser/");

var alt5 = new Array(
"1600MM UV Vanishing Machine",
"920MM Guillotine",
"480MM Guillotine",
"1370MM Guillotine",
"Matt UV Vanish Coating",
"Auto Folder Creaser");

var currentAd5 = 0;

var imgCt5 = 5;
function cycle5() {
if (currentAd5 == imgCt5) {
currentAd5 = 0;
}
var banner5 = document.getElementById('adBanner5');
var link5 = document.getElementById('adLink5');
banner5.src=imgs6[currentAd5]
banner5.alt=alt5[currentAd5]
document.getElementById('adLink5').href=lnks5[currentAd5]
currentAd5++;
}
window.setInterval("cycle5()",7000);
// -->
</script>

This site is using it
http://www.pressroomgraphics.com.au

Thanks
LVL 11
Amanda WatsonWeb DeveloperAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
replace :
banner5.src=imgs6[currentAd5]
by :
banner5.src=imgs5[currentAd5]
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Hi there, that didn't change anything at all

There are 6 images in the array - what else could be stopping this from working?
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Hang on that did fix it thanks
So how can I add a new iamge and link here safely?>
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
I just added another image and it isn't showing?
<script type="text/javascript"><!--
var imgs5 = new Array(
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-2-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-4-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-5-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-6-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-7-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-8-final.jpg",
"http://www.pressroomgraphics.com.au/wp-content/uploads/pressroom-banner-9-final.jpg");

var lnks5 = new Array(
"http://www.pressroomgraphics.com.au/machines/laminating/1600-uv-liquid-laminator/",
"http://www.pressroomgraphics.com.au/machines/guillotines/touch-screen-double-hydraulic-double-guide-guillotine/",
"http://www.pressroomgraphics.com.au/machines/guillotines/480mm-guillotine/",
"http://www.pressroomgraphics.com.au/machines/guillotines/qzk1370/",
"http://www.pressroomgraphics.com.au/inks/",
"http://www.pressroomgraphics.com.au/machines/diecutting-creasing/auto-folder-creaser/",
"http://www.pressroomgraphics.com.au/machines/guillotines/ar670v-fullar-hydraulic-guillotine/");

var alt5 = new Array(
"1600MM UV Vanishing Machine",
"920MM Guillotine",
"480MM Guillotine",
"1370MM Guillotine",
"Matt UV Vanish Coating",
"Auto Folder Creaser",
"AR670V Fullar Hydraulic Gullotine");

var currentAd5 = 0;

var imgCt5 = 5;
function cycle5() {
if (currentAd5 == imgCt5) {
currentAd5 = 0;
}
var banner5 = document.getElementById('adBanner5');
var link5 = document.getElementById('adLink5');
banner5.src=imgs5[currentAd5]
banner5.alt=alt5[currentAd5]
document.getElementById('adLink5').href=lnks5[currentAd5]
currentAd5++;
}
window.setInterval("cycle5()",7000);
// -->

What do I need to change to get it to show?
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Thank you all sorted ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.