jquery 方法
复制代码 代码如下:
$( 
function () {
//页面加载时计算人员统计表合计值 
calcsum();
});
//合计行计算 
/* 
以合计行为中间变量 
每个单元格与该列合计行相加 
得到每列合计 
*/ 
function trvisible(chk, index) {
var disvalue = $(#tr + index).css(display); 
if (chk.checked) {
$(#tr + index).css(display, block); 
} 
else { 
$(#tr + index).css(display, none); 
} 
calcsum(); 
} 
function calcsum() {
//合计行赋初始值0 
$(#trsum).each(function () { 
$(this).find(td).each(function () { 
if ($(this).index() != 0) { 
$(this).text(0); 
} 
}); 
});
$(#tabrytj).find(tr).each(function () { 
var trdis = $(this).css(display); 
//隐藏行不参与计算 
if (trdis == block) { 
$(this).find(td).each(function () { 
var index = $(this).index(); 
if (index >= 1) { 
var tdvalue = $(#trsum).find(td:eq( + index + )).text(); 
//totalsum += parsefloat($(this).text()); 
$(#trsum).find(td:eq( + index + )).text(parsefloat(tdvalue) + parsefloat($(this).text())); 
} 
}); 
} 
});
}
html语句 
复制代码 代码如下:
分公司
华南分公司
张1  
张2  
张3  
张4  
张5  
张6
张1   
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536
张2   
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536
张23   
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536  
124536
0  
0  
0  
0  
0  
0  
0  
0  
0  
0
   
 
   