随机产生16进制颜色值

function getColor{
var str="#";
var arr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
for(var i=0;i<6;i++){
var num=parseInt(Math.random()*16);
str+=arr[num];
}
return str;
}

console.log(getColor());
posted @ 2019-01-17 14:44  燕十三丶  阅读(461)  评论(0编辑  收藏  举报
AmazingCounters.com