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.text()==_w_table_currenttd.text()){ _w_table_SpanNum++; _w_table_currenttd.hide(); //remove(); _w_table_firsttd.attr("rowSpan",_w_table_SpanNum); }else{ _w_table_firsttd = $(this); _w_table_SpanNum = 1; } } }); } $(document).ready(function(){ _w_table_rowspan("#dataTable",1); });
<table id="dataTable" class="table1" border="1" align="center" cellpadding="0" width="90%" cellspacing="0" > <tr> <td colspan="10" align="center"> <font color="red"> 【年级:<param:display type="xxnj1Tag" name="bjkcForm" property="bjkcbQO.nj" condition="bjkcbQO.xxdm,bjkcbQO.xn,bjkcbQO.xq"/>】 【班级:<param:display type="bjmcTag" name="bjkcForm" property="bjkcbQO.bjdm"/>】 </font> </td> </tr> <tr height="30"> <th nowrap="nowrap" class="center"> 上午/下午 </th> <th nowrap="nowrap" class="center"> 时段 </th> <th nowrap="nowrap" class="center"> 时间 </th> <th nowrap="nowrap" class="center"> 星期一 </th> <th nowrap="nowrap" class="center"> 星期二 </th> <th nowrap="nowrap" class="center"> 星期三 </th> <th nowrap="nowrap" class="center"> 星期四 </th> <th nowrap="nowrap" class="center"> 星期五 </th> </tr> <logic:iterate name="bjkcForm" property="kcblist" id="bjkcbPO" indexId="index"> <tr height="30"> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="sxw"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="jhmc"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="qssj"/>~~<bean:write name="bjkcbPO" property="zzsj"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="z1kcmc"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="z2kcmc"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="z3kcmc"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="z4kcmc"/> </td> <td class="center" nowrap="nowrap" align="center"> <bean:write name="bjkcbPO" property="z5kcmc"/> </td> </tr> </logic:iterate> </table>