Image Rotator

I created a image scrolling script for a website. Below is the Javascript and HTML code to use it. Please leave the credits to me

var indexBannersNum = 0;
var indexBanners = new Array();
/*
 * IMAGE ROTATOR SCRIPT
 * CREATED BY KENNY ROBINSON
 * http://thealmostengineer.com
 */
function imageRotator(){

    //INDEXBANNERS[]=[IMAGE URL, ALTERNATE TEXT, WEBPAGE URL]
    indexBanners[0]=["image1.jpg","Alternate Text","url.html"]
    indexBanners[1]=["image2.jpg","Alternate Text","url.html"]
    indexBanners[2]=["image3.jpg","Alternate Text","url.html"]
    indexBanners[3]=["image4.jpg","Alternate Text","url.html"]

    document.getElementById("image_reel").innerHTML =
        "<a href='" + indexBanners[indexBannersNum][2] + "'>" +
        "<img src='nbcfc_images/" + indexBanners[indexBannersNum][0] + "' alt='" + indexBanners[indexBannersNum][1] +
        "' style='border-width: 0px;' />" +
        "</a>";
    if(indexBannersNum >= (indexBanners.length-1)){
        indexBannersNum = 0;
    }
    else{
        indexBannersNum++;
    }

    //YOU MAY CHANGE THE DELAY. THE TIME IS IN MILLISECONDS. I.E. 6000 MILLISECONDS = 6 SECONDS
    setTimeout("imageRotator();",6000);
}

Modify your opening body tag to include the text below.

onload="imageRotator()"

Add the code below where you want the image to appear.

<div id="image_reel">
    <!--
    IMAGE ROTATOR SCRIPT; CREATED BY KENNY R.;
    HTTP://THEALMOSTENGINEER.COM
    -->
    <a href="url.html"><img src="image1.jpg" alt="Default Image" /></a>
    <!--
    CHANGE THE IMAGE SOURCE AND ALTERNATE TEXT TO THE IMAGE THAT YOU ONE TO SHOW FOR INCOMPATIABLE BROWSERS. ALSO
    CHANGE THE URL TO MAKE THE DEFAULT PAGE YOU WANT TO LINK TOO.
    -->
</div>
Updated: 2020-07-15 | Posted: 2011-07-12