码迷,mamicode.com
首页 > Web开发 > 详细

js 随机色

时间:2017-09-27 13:13:53      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:rand   slice   class   fun   ice   style   ret   rgb   span   

    //生成随机色
    function colorRandom() {
        colorStr = "#" + ("00000" + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6);
        return colorStr;
//        var r=Math.floor(Math.random()*256);
//        var g=Math.floor(Math.random()*256);
//        var b=Math.floor(Math.random()*256);
//        return `rgb(${r},${g},${b})`;

    };

 

js 随机色

标签:rand   slice   class   fun   ice   style   ret   rgb   span   

原文地址:http://www.cnblogs.com/xzma/p/7600839.html

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