jquery 实现。同列中的数据相同的话合并

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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值