背景颜色随机获取效果

$(function(){
var tags = $(".tag");
tags.each(function(){
    var r = Math.floor(Math.random()*255);
    var g = Math.floor(Math.random()*255);
    var b = Math.floor(Math.random()*255);
    $(this).css("background-color","rgb(" + r +"," + g +"," + b + ")");
})
})
posted @ 2015-04-02 12:49  eric_z  阅读(420)  评论(0编辑  收藏  举报