var color = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F".split(",")
var tmp;
window.document.bgColor = "#000000";
for (index = 0;index < 16;index++) {
tmp = "";
for (cnt = 0;cnt < 6;cnt++) { tmp += color[index]; }
color[index] = "#" + tmp;
}
function setbgColor(index){
window.document.bgColor = color[index];
if (index < 15) { setTimeout("setbgColor(" + eval(index + 1) + ")",100); }
}
<BODY onLoad="setbgColor(0);">