十六进制颜色随机值

mac2022-06-30  134

console.log(parseInt(Math.random()*5)); // 十六进制颜色随机值 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());

 

转载于:https://www.cnblogs.com/ivylv/p/11406478.html

相关资源:随机生成16进制的颜色值
最新回复(0)