欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JS前端合并TABLE相同列的单元格

程序员文章站 2022-06-14 09:46:05
...
function _w_table_rowspan(_w_table_id,_w_table_colnum){
    _w_table_firsttd = "";     
    _w_table_currenttd = "";     
    _w_table_SpanNum = 0;     
    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");     
    _w_table_Obj.each(function(i){     
        if(i==0){     
            _w_table_firsttd = $(this);     
            _w_table_SpanNum = 1;     
        }else{     
            _w_table_currenttd = $(this);  
            if(_w_table_firsttd.parent().attr("invoiceNumber") ==_w_table_currenttd.parent().attr("invoiceNumber")){     
                _w_table_SpanNum++;
                $(_w_table_currenttd).attr("disable", "true");
                _w_table_currenttd.hide(); //remove();     
                _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);     
            }else{     
                _w_table_firsttd = $(this);     
                _w_table_SpanNum = 1;     
            }     
        }
    });
}