码迷,mamicode.com
首页 > 其他好文 > 详细

随机16进制颜色练习

时间:2017-07-03 17:24:01      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:随机   val   tle   颜色   math   value   lang   meta   and   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>随机颜色</title>
</head>
<body>
<script>
    function getColr(){
        var colorValue = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f";
        var colorArray = colorValue.split(",");
        var color = "#";
        for(var i = 0; i < 6; i++){
            color += colorArray[Math.floor(Math.random()*16)]
        }
        return color;
    }
    console.log(getColr());
</script>
</body>
</html>

 

随机16进制颜色练习

标签:随机   val   tle   颜色   math   value   lang   meta   and   

原文地址:http://www.cnblogs.com/-CLAY-/p/7111909.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!