JS生成随机十六位的颜色的数值

JS生成随机十六位的颜色的数值

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
   <script>
       function getColor() {
           var str="#";
           var co=["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
           for (var j=0;j<6;j++)
           {
               colors=co[parseInt(Math.random()*15)];
               str+=colors;
           }
           return str;
       }
       console.log(getColor());
   </script>
</head>
<body>

</body>
</html>
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注