JSP页面实现部分行合并

function fixRowspan() {
        var tb = document.getElementById("budgetItem"); 
        var row_span_num = 1; 
        var first_row_title = ""; 
        var first_row_obj = null; 
        for ( var i = 1; i < tb.rows.length; i++) { 
            var first_new_row_title = tb.rows[i].cells[0].innerHTML; 
            if (first_row_title != "" && first_row_title == first_new_row_title) { 
                tb.rows[i].deleteCell(11); 
                tb.rows[i].deleteCell(10); 
                tb.rows[i].deleteCell(9); 
                row_span_num++; 
                first_row_obj4.setAttribute("rowSpan", row_span_num); 
                first_row_obj3.setAttribute("rowSpan", row_span_num); 
                first_row_obj2.setAttribute("rowSpan", row_span_num); 
                first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
            } else { 
                if (first_row_title != "") { 
                    first_row_obj4.setAttribute("rowSpan", row_span_num); 
                    first_row_obj3.setAttribute("rowSpan", row_span_num); 
                    first_row_obj2.setAttribute("rowSpan", row_span_num); 
                    first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
                    row_span_num = 1; 
                } 
                first_row_obj = tb.rows[i].cells[0]; 
                first_row_obj4 = tb.rows[i].cells[11]; 
                first_row_obj3 = tb.rows[i].cells[10]; 
                first_row_obj2 = tb.rows[i].cells[9]; 
                first_row_title = first_new_row_title; 
            } 
            
        } 
        var row_span_num = 1; 
        var first_row_title = ""; 
        var first_row_obj = null; 
        for ( var i = 1; i < tb.rows.length; i++) { 
            var first_new_row_title = tb.rows[i].cells[1].innerHTML; 
            if (first_row_title != "" && first_row_title == first_new_row_title) { 
                tb.rows[i].deleteCell(8); 
                tb.rows[i].deleteCell(7); 
                tb.rows[i].deleteCell(6); 
                row_span_num++; 
                first_row_obj4.setAttribute("rowSpan", row_span_num); 
                first_row_obj3.setAttribute("rowSpan", row_span_num); 
                first_row_obj2.setAttribute("rowSpan", row_span_num); 
                first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
            } else { 
                if (first_row_title != "") { 
                    first_row_obj4.setAttribute("rowSpan", row_span_num); 
                    first_row_obj3.setAttribute("rowSpan", row_span_num); 
                    first_row_obj2.setAttribute("rowSpan", row_span_num); 
                    first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
                    row_span_num = 1; 
                } 
                first_row_obj = tb.rows[i].cells[1]; 
                first_row_obj4=tb.rows[i].cells[8];
                first_row_obj3=tb.rows[i].cells[7];
                first_row_obj2=tb.rows[i].cells[6];
                first_row_title = first_new_row_title; 
            } 
        } 
        var row_span_num = 1; 
        var first_row_title = ""; 
        var first_row_obj = null; 
        for ( var i = 1; i < tb.rows.length; i++) { 
            var first_new_row_title = tb.rows[i].cells[1].innerHTML; 
            if (first_row_title != "" && first_row_title == first_new_row_title) { 
                tb.rows[i].deleteCell(1); 
                row_span_num++; 
                first_row_obj.setAttribute("rowSpan", row_span_num); 
                first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
            } else { 
                if (first_row_title != "") { 
                    first_row_obj.setAttribute("rowSpan", row_span_num); 
                    first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
                    row_span_num = 1; 
                } 
                first_row_obj = tb.rows[i].cells[1]; 
                first_row_title = first_new_row_title; 
            } 
        } 
        var row_span_num = 1; 
        var first_row_title = ""; 
        var first_row_obj = null; 
        for ( var i = 1; i < tb.rows.length; i++) { 
            var first_new_row_title = tb.rows[i].cells[0].innerHTML; 
            if (first_row_title != "" && first_row_title == first_new_row_title) { 
                tb.rows[i].deleteCell(0); 
                row_span_num++; 
                first_row_obj.setAttribute("rowSpan", row_span_num); 
                first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
            } else { 
                if (first_row_title != "") { 
                    first_row_obj.setAttribute("rowSpan", row_span_num); 
                    first_row_obj.innerHTML = first_row_title.replace("/", "
"); 
                    row_span_num = 1; 
                } 
                first_row_obj = tb.rows[i].cells[0]; 
                first_row_title = first_new_row_title; 
            } 
           
            
        }

    }

 

JSP页面实现部分行合并_第1张图片

你可能感兴趣的:(JSP)