代码片段:
for(var r=0;r<255;r+=65){
for(var b=0;b<255;b+=65){
for(var g=0;g<255;g+=65){
div=document.createElement("div");
div.setAttribute("class","item");
div.setAttribute("data-r",r);
div.setAttribute("data-g",g);
div.setAttribute("data-b",b);
div.style.backgroundColor="rgba("+r+","+g+","+b+","+"1)";
initColor.appendChild(div);
div.onclick=function(){
document.getElementById("nowSelectColor").style.backgroundColor="rgba("+this.getAttribute("data-r")+","+this.getAttribute("data-g")+","+this.getAttribute("data-b")+","+"1)";
colorObj.r=this.getAttribute("data-r");
colorObj.g=this.getAttribute("data-g");
colorObj.b=this.getAttribute("data-b");
}
}
}
}
申明:本站所有资源都是转载各大下载站,或由网友投稿发布,请自行检测软件的完整性,如有侵权请联系我们删除下架,联系方式:admin@php.cn