Try changing this function:
Code:
function expandone(){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv)
contractall()
document.getElementById("dropcontentsubject").innerHTML=selectedDivObj.getAttribute("subject")
selectedDivObj.style.display="block"
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
setTimeout("expandone()",tickspeed)
}
to:
Code:
function expandone(){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv)
contractall()
document.getElementById("dropcontentsubject").innerHTML=selectedDivObj.getAttribute("subject")
selectedDivObj.style.display="block"
var tempDiv=selectedDiv
while (tempDiv==selectedDiv)
selectedDiv=random(totalDivs)
setTimeout("expandone()",tickspeed)
}
and adding this just after it in the code:
Code:
function random(n) {
return Math.floor((Math.random() % 1) * n);
}
Taken loosely from this thread:
http://www.dynamicdrive.com/forums/s...ead.php?t=2564
especially message #6
But, be aware that random means random. I've eliminated the possibility of the same message displaying repeatedly (as would be possible in a truly random scheme) but, it is still possible to alternate repeatedly between two messages. The more messages, the less likely this is to happen but, it will happen - that's random for ya'.
Bookmarks