Random Color Generation in JavaScript

by Milan Gladiš

HTML

<div id="test"></div>

CSS

#test {
    width:200px;
    height:200px;
}

JavaScript

var ob = document.getElementById("test");

function change_color() {
    ob.style.backgroundColor = "#" + ((1 << 24) * Math.random() | 0).toString(16);
}
setInterval(change_color,100)