I use this simple code in the body of my site to rotate banners. It’s simple and works well.
How would I modify the code to start the rotation at random (not always the first banner)
Thanks
Sandy
<script type=”text/javascript”>
var imgs1 = new Array(“Temp01a.jpg”,”Temp02a.jpg”,”Temp03a.jpg”,”Temp04a.jpg”,”Temp05a.jpg”,”Temp06a.jpg”,”Temp07a.jpg”,”Temp08a.jpg”,”Temp09a.jpg”);
var lnks1 = new Array(“http://xx1.com”,”http://xx2.com”,”http://xx3.com”,”http://xx4.com”,”http://xx1.com”,”http://xx5.com”,”http://xx5.com”,”http://xx7.com”,”http://xx8.com”,”http://xx9.com””);
var alt1 = new Array();
var currentAd1 = 0;
var imgCt1 = 9;
function cycle1() {
if (currentAd1 == imgCt1) {
currentAd1 = 0;
}
var banner1 = document.getElementById(‘adBanner1’);
var link1 = document.getElementById(‘adLink1’);
banner1.src=imgs1[currentAd1]
banner1.alt=alt1[currentAd1]
document.getElementById(‘adLink1’).href=lnks1[currentAd1]
currentAd1++;
}
window.setInterval(“cycle1()”,6000);
</script>
<P ALIGN=CENTER>
<a href=””
<img src=”Temp01.jpg” id=”adBanner1″ border=”0″ width=”774″ height=”230″>