function FXRowCombination1(tableObj,columnArr,columnIndex,beginIndex,endIndex,makeMark) { //var tableObj = document.getElementById(tableName); var rowsObj = tableObj.rows; var divisor = divisorTemp = 0; for( var i = beginIndex; i <endIndex; i++) { if(divisorTemp==0) { divisor = divisorTemp = judgeCombinationCount1(rowsObj,i,endIndex,columnArr[columnIndex],makeMark); } if(divisor == divisorTemp) { rowsObj[i].cells(columnArr[columnIndex]).setAttribute("rowSpan",divisor); } else { rowsObj[i].removeChild(rowsObj[i].children(columnArr[columnIndex]-makeMark)); } divisorTemp --; } if(columnIndex == columnArr.length-1) { return; } FXRowCombination1(tableObj,columnArr,++columnIndex,beginIndex,endIndex,++makeMark); } function judgeCombinationCount1(rowsObj,rowsBeginIndex,rowsMaxSize,columnIndex,makeMark) { var m=1; while(true) { if(rowsBeginIndex+m == rowsMaxSize || rowsObj[rowsBeginIndex].cells[columnIndex].innerHTML != rowsObj[rowsBeginIndex+m].cells[columnIndex-makeMark].innerHTML) { return m; } m++; } } // 调用 FXRowCombination1(tableObj,[1,2,5,6,7,8,9],0,0,table_RowsSize,0);