生成随机颜色

78 阅读1分钟

`function changecolor(obj) {

    var r = Math.floor(Math.random() * 256);
    var g = Math.floor(Math.random() * 256);
    var b = Math.floor(Math.random() * 256);
    obj.style.backgroundColor = `rgb(${r},${g},${b})`//正则改变颜色
}`