Javascript
function RandomColor() {
var Color = "#" + Math.floor(Math.random() * 16777215).toString(16);
return Color;
//color will be freshly served
}
function Change() {
document.body.style.backgroundColor = RandomColor(); // -> #e1ac94
someDiv.style.color = Color();
}
Top comments (4)
nice
thanks bro
What happens when you get a colour like #09df6c? I found that the leading zero always got stripped away.
at least learn to properly format your code before writing something like this