首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

报表中同一列的相同元素合并单元格

2012-10-14 
表格中同一列的相同元素合并单元格列的css class为class_namevar that$(.class_name).each(function(){

表格中同一列的相同元素合并单元格
列的css class为class_name

   var that;$(".class_name").each(function(){if ($(this).text() == $(that).text()) {rowspan = $(that).attr("rowSpan");if (rowspan == undefined) {$(that).attr("rowSpan", 1);   rowspan = $(that).attr("rowSpan");   }rowspan = Number(rowspan) + 1;$(that).attr("rowSpan", rowspan); // do your action for the colspan cell here$(this).remove(); // .remove(); // do your action for the old cell here    } else {that = this;    }});

热点排行