<script type="text/javascript"> var mod = '<?=seg(1)?>'; // //子基金基本情况统计 if(mod == 'tj_tzjc'){ //插入最后一行tr 然后进行叠加 var html="<tr><td class='nowrap align-center'>总计</td><td class=' '><td class=' '></td><td class='hide-sm '>"+gettv(3)+"</td><td class='hide-sm '>"+gettv(4)+"</td><td class='hide-sm hide-md '>"+gettv(5)+"</td><td class='hide-sm hide-md '></td><td class='hide-sm hide-md '>"+gettv(7)+"</td><td class='hide-sm hide-md '>"+gettv(8)+"</td><td class='hide-sm hide-md '>"+gettv(9)+"</td><td class='hide-sm hide-md '>"+gettv(10)+"</td><td class='hide-sm hide-md '>"+gettv(11)+"</td><td class='hide-sm hide-md '>"+gettv(12)+"</td><td class='hide-sm hide-md '>"+gettv(13)+"</td><td class='hide-sm hide-md '>"+gettv(14)+"</td></tr>"; $("tbody").append(html); }else if(mod == 'tj_bfcz'){ var html="<tr><td class='nowrap align-center'>总计</td><td class=' '></td><td class=' '></td><td class='hide-sm '></td><td class='hide-sm '>"+gettv(4)+"</td><td class='hide-sm hide-md '>"+gettv(5)+"</td><td class='hide-sm hide-md '>"+gettv(6)+"</td><td class='hide-sm hide-md '>"+gettv(7)+"</td><td class='hide-sm hide-md '></td><td class='hide-sm hide-md '> </td><td class='hide-sm hide-md '>"+gettv(10)+"</td><td class='hide-sm hide-md '>"+gettv(11)+"</td><td class='hide-sm hide-md '></td><td class='hide-sm hide-md '></td><td class='hide-sm hide-md '></td></tr>"; $("tbody").append(html); } /*获取table 里面指定列的值 * @param col 指定列 */ function gettv(col){ var nums = 0; var num=''; $("tbody").find("tr").each(function(){ var tdArr = $(this).children(); num = (tdArr.eq(col))[0].innerText.replace(/,/g,''); if(num ==''){ num=0; } nums += parseFloat(num); }); var fnums = RetainedDecimalPlaces(nums, 2); return fnums; } function RetainedDecimalPlaces(num, del) //值:num 小数位:del { if (del != 0) { num = parseFloat(num).toFixed(del); //天花板函数保留小数并四舍五入 } var source = String(num).split(".");//按小数点分成2部分 source[0] = source[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)', 'ig'), "$1,");//只将整数部分进行都好分割 return source.join(".");//再将小数部分合并进来 }; </script>