__(Added `[code]…[/code]
I found Java Script code to create a scrolling banner for some ads I’m going to have on my site, however it scrolls in order. I want to randomize this. I’ll post the code below:
[code]
<script language=”JavaScript1.2″>
var howOften = 5; //number often in seconds to rotate
var current = 0; //start the counter at 0
var ns6 = document.getElementById&&!document.all; //detect netscape 6
// place your images, text, etc in the array elements here
var items = new Array();
items[0]=”<a href=’sponsor.php’ ><img alt=’image0 (9K)’ src=’ http://www.hyhpawardshow.com/images/1.png’ height=’200′ width=’200′ border=’0′ /></a>”; //a linked image
items[1]=”<a href=’https://scarehollow.wixsite.com/haunt’ ><img alt=’Scare Hollow’ src=’ http://www.hyhpawardshow.com/images/2.jpg’ height=’200′ width=’200′ border=’0′ /></a>”;
items[2]=”<a href=’http://www.samhaynes.moonfruit.com/’ ><img alt=’Sam Haynes’ src=’ http://www.hyhpawardshow.com/images/3.jpg’ height=’200′ width=’200′ border=’0′ /></a>”;
spon
function rotater() {
document.getElementById(“placeholder”).innerHTML = items[current];
current = (current==items.length-1) ? 0 : current + 1;
setTimeout(“rotater()”,howOften*1000);
}
function rotater() {
if(document.layers) {
document.placeholderlayer.document.write(items[current]);
document.placeholderlayer.document.close();
}
if(ns6)document.getElementById(“placeholderdiv”).innerHTML=items[current]
if(document.all)
placeholderdiv.innerHTML=items[current];
current = (current==items.length-1) ? 0 : current + 1; //increment or reset
setTimeout(“rotater()”,howOften*1000);
}
window.onload=rotater;
//–>
</script>
I have a feeling it has to do with this part of the code: ` current = (current==items.length-1) ? 0 : current + 1;
Can anyone help me make this scrolling banner randomized?