The following Javascript code will help you change the background-color of your web-page automatically and at a time-interval (in milli-seconds) as specified in the code.
/* Method To Generate Random Numbers Between "0-255" for RGB Color-code Format & Assign To Body-Backgrond-Style */
function bgDisco()
{
var x =Math.round(255*Math.random());
var num1 =getHex(x);
var y =Math.round(255*Math.random());
var num2 =getHex(y);
var z =Math.round(255*Math.random());
var num3 =getHex(z);
document.body.style.background="#"+num1+num2+num3;
setTimeout("bgDisco()",1000);
}
/* Method To Convert Decimal To Hexadecimal */
function getHex(dec)
{
var hexArray = new Array( "0", "1", "2", "3","4", "5", "6", "7","8", "9", "A", "B","C", "D", "E", "F" );
var code1 = Math.floor(dec / 16);
var code2 = dec - code1 * 16;
var decToHex = hexArray[code2];
return (decToHex);
}
Now on the body part call the “bgDisco()” in onload event.