I have written a simple program which is designed to change the background colour of a DIV every second (from rgb 1,1,1 through to rgb 255,255,255) creating a transition effect. I'm unsure what I am doing wrong and I can't get it working. Any ideas?
Thanks,
Chris
Code:
window.onload=Ftrans(0);
function Ftrans(i){
d=document.getElementById('main');
d.style.backgroundColor='rgb(' + i + ',' + i + ',' + i + ')';
if(i<=255){
setTimeout("Ftrans(i+1)",1*1000);
}
}
Thanks,
Chris