jsp中td值相同合并的问题

花生丶 花生丶 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区



如图,已根据之前一位大神的帖子把第一列中相同的合并了,现在的情况是:除了第二列,后面的3列要跟着第一列的合并来合并,求来个大神解答,第一列合并的js如下:
<tr>
<td class="hebing" style="text-align: center;">
${honor.honorOrgName }
</td>
.....
</tr>



$('.hebing').each(function(index, element) {
if(!$(this).hasClass('hide'))
{ var next=$(this).parent('tr').next('tr').children('.hebing');//下一个合并的对象
$(this).attr('rowspan',1);
while($(this).text()==next.text())
{
//合并
$(this).attr('rowspan',parseInt($(this).attr('rowspan'))+1);
//文字居中 添加等值的height和line-height
$(this).attr('style',"height:"+((parseInt($(this).attr('rowspan'))+1)*30)+"px;");
$(this).attr('style',"line-height:"+((parseInt($(this).attr('rowspan'))+1)*30)+"px;");
next.hide();
next.addClass('hide');
next=next.parent('tr').next('tr').children('.hebing');//下一个合并的对象
}
}
});
...全文
评论
收藏 已收藏
分享
返回顶部
花生丶
JavaScript 87,983 成员 224,681 内容