Seldudet
08-20-2002, 04:15 PM
Hello..i was trying to make a script that changed the colours of my text every so often:-
num=1
function changecolor()
{
colours=new Array()
colours[0]='green'
colours[1]='blue'
colours[2]='yellow'
colours[3]='red'
colours[4]='gold'
colours[5]='silver'
for(i=1;i<20;i=i+1)
{document.fgColor=colours[num]
for(s=1;s<800;s=s+1)
{}
num=num+1
if(num==5)
{num=1}
}
}
........
<BODY onLoad='javascript:changecolor()'>Welcome
However, the problem is, when u load the page, nothing happens!!! no script errors or nothing, and the text does not change color. I heard sometimes this kind of animation or whatever its called doesn't work in MSIE later versions, so i tried Opera, but it doesnt work there either. I can't figure it out, i have set it to run on body onLoad, but it doesnt do a thing! Anybody made a script like this and know what i have done wrong or missed out?
num=1
function changecolor()
{
colours=new Array()
colours[0]='green'
colours[1]='blue'
colours[2]='yellow'
colours[3]='red'
colours[4]='gold'
colours[5]='silver'
for(i=1;i<20;i=i+1)
{document.fgColor=colours[num]
for(s=1;s<800;s=s+1)
{}
num=num+1
if(num==5)
{num=1}
}
}
........
<BODY onLoad='javascript:changecolor()'>Welcome
However, the problem is, when u load the page, nothing happens!!! no script errors or nothing, and the text does not change color. I heard sometimes this kind of animation or whatever its called doesn't work in MSIE later versions, so i tried Opera, but it doesnt work there either. I can't figure it out, i have set it to run on body onLoad, but it doesnt do a thing! Anybody made a script like this and know what i have done wrong or missed out?