let tags = document.getElementById("tags").getElementsByTagName("a");
for(let i in tags){
let r = Math.floor(Math.random()*256);
let g = Math.floor(Math.random()*256);
let b = Math.floor(Math.random()*256);
tags[i].style.background = 'rgba('+r+','+g+','+b+')';
}
js用rgb标签随机颜色
未经允许不得转载:阿锋哥前端开发经验分享 » js用rgb标签随机颜色