1.

Solve : Rotating Banner Ad?

Answer»

I have a code for a rotating banner which works great but at the moment all it does is rotate in sequence 1,2,3,4 and over again. Is it possible to ad a COMMAND that will enable it to display randomly rather than in sequence? Any help at all would be greatly appreciated. 

Code: [Select]<script type="text/javascript">
var imgs2 = new Array("");
var lnks2 = new Array("");
var ALT2 = new Array();
var currentAd2 = 0;
var imgCt2 = 4;
function cycle2() {
if (currentAd2 == imgCt2) {
currentAd2 = 0;
}
var banner2 = document.getElementById('adBanner2');
var link2 = document.getElementById('adLink2');
banner2.src=imgs2[currentAd2]
banner2.alt=alt2[currentAd2]
document.getElementById('adLink2').HREF=lnks2[currentAd2]
currentAd2++;
}
window.setInterval("cycle2()",10000);
</script>
<a href="" id="adLink2" target="_blank">
<img src="" id="adBanner2" BORDER="0" width="468" height="60" /></a>
GooooooooogleIf you can use PHP or ANOTHER server based Script it would be better then relying on the clients javascript support.



Discussion

No Comment Found