Trying to put together a simple javascript code to make a series of text snips fade into and out of visibility in random intervals. It isn't working now, but it's not producing any specific erors to focus debugging on either. Any thoughts on what I'm doing wrong?:
Code:
var CommentList = ['Com1','Com2','Com3','Com4','Com5','Com6','Com7','Com8','Com9','Com10','Com11','Com12','Com13','Com14','Com15','Com16'];
var CommentOn = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
function SetOpacity(ComID,Value){
document.getElementById(ComID).style.opacity = Value;
}
function resetOn(OnID){
CommentOn[OnID] = 0;
}
function CommentTwinkle(comment){
document.getElementById(CommentList[comment]).style.visibility=visible;
CommentOn[comment] = 1;
for (i = 0; i <= 1; i = i + 0.05) {
setTimeout("setOpacity(" +CommentList[comment]+","+ i + ")", i * 3000);
setTimeout("setOpacity(" +CommentList[comment]+","+ (1-i) + ")", 8000+(i * 3000));
setTimeout(resetOn(comment),12000)
}
Rand = 0;
CueIt=0;
function CueComment(){
while (CueIt == 1){
Rand = math.random()*(CommentList.count);
CueIt = CommentOn[Rand];
}
CommentTwinkle(Rand);
setTimeout('CueComment()',1000)
}
document.body.onload=CueComment();