js 随机色

    //生成随机色
    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})`;

    };

 

posted @ 2017-09-27 11:27  吾生有涯,而知无涯!  阅读(150)  评论(0编辑  收藏  举报