function getColor(){ var colorElements = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f"; var colorArray = colorElements.split(","); var color ="#"; for(var i =0;i<6;i++){ color+=colorArray[Math.floor(Math.random()*16)]; } return color;}
本文共 311 字,大约阅读时间需要 1 分钟。
function getColor(){ var colorElements = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f"; var colorArray = colorElements.split(","); var color ="#"; for(var i =0;i<6;i++){ color+=colorArray[Math.floor(Math.random()*16)]; } return color;}
转载于:https://www.cnblogs.com/moonlignt/p/7299637.html