颜色随机


function randomColor(){

r = Math.floor(Math.random()*255).toString(16);

g = Math.floor(Math.random()*255).toString(16);

b = Math.floor(Math.random()*255).toString(16);

return "#"+r+g+b;

}

var nod=getElementById("nod");

var clr=randomColor();

nod.style.backgroundColor=clr;

原文地址:https://www.cnblogs.com/cly84920/p/4427190.html