随机色&原生DOM筛选元素

函数colorRandom1 () {

var r=Math.floor 51 (math . random () * + 200);

var g=Math.floor 51 (math . random () * + 200); b

var=Math.floor 51 (math . random () * + 200);

返回的rgb (+ r +, + g +, + b +)的;

}

var div=document.body.getElementsByTagName (div) [0];

div.style。背景=colorRandom ();

div.setAttribute(“风格”,“颜色:”+ colorRandom() +“;背景:”+ colorRandom ());


随机色&原生DOM筛选元素