js设置奇偶行数样式

$(document).ready(function () {
        odd = { "background": "none" };    //奇数样式 
        even = { "background": "#f3f3f3" }; //偶数样式 
        odd_even(".gys_xq", odd, even);
    });

function odd_even(id, odd, even) {
        $(id).find("dl").each(function (index, element) {
            if (index % 2 == 1)
                $(this).css(even);
            else
                $(this).css(odd);
        });
    } 

  

posted @ 2016-03-01 10:49  朝闲  阅读(892)  评论(0编辑  收藏  举报