设置 jsp 表格相邻两行的颜色不一样

转载网址:https://zhidao.baidu.com/question/134905332.html?fr=iks&word=for+%28var+i%3D0%3Bi%3CTable.rows.length%3Bi%2B%2B%29+Table.rows%5Bi%5D.bgColor%3Di%252%3FBg2%3ABg1%3B&ie=gbk

使用JavaScript:

<script type="text/javascript">
    window.onload = function() {
     //注意这里不需要加#号
        doubleBgColor(document.getElementById("record_table"),"#f8fbfc","#e5f1f4");
    }
    function doubleBgColor(Table,Bg1,Bg2) {
        for (var i=0;i<Table.rows.length;i++) Table.rows[i].bgColor=i%2?Bg2:Bg1;
    }
</script>
原文地址:https://www.cnblogs.com/GooPolaris/p/7919848.html