function random(MaxValue) { day = new Date(); min = day.getMinutes(); sec = day.getSeconds(); return(((min + 1) * sec) % MaxValue) +1; } function MakeArray(size) { this.length = size; for(var i=1; i <= size; i++) { this[i] = 0; } return this; } function randomColor() { colorArray = new MakeArray(9); colorArray[1] = "#FFFFFF"; colorArray[2] = "#FF0000"; colorArray[3] = "#00FF00"; colorArray[4] = "#0000FF"; colorArray[5] = "#C0C0C0"; colorArray[6] = "#FF69B4"; colorArray[7] = "#FFDEAD"; colorArray[8] = "#FFA500"; colorArray[9] = "#1E90FF"; document.bgColor = colorArray[random(9)]; }