求助:我想在表格生成之后在最后一行添加一个合计行,计算每列的总和
求助 JS做的 jquery做的都行 --------------------编程问答-------------------- 取你每一列的值$("xxx").text() 求和即可 --------------------编程问答-------------------- 用 jquery 吧,强大的选择器功能 --------------------编程问答-------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>第一个简单的jQuery程序</title>
<link type="text/css" rel="stylesheet" href="js/zTreeStyle/zTreeStyle.css" />
<link type="text/css" rel="stylesheet" href="js/zTreeStyle/zTreeIcons.css" />
<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
<script type="text/javascript" src="js/zTree/jquery.ztree-2.6.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script language="JavaScript" type="text/javascript">
$(function(){
$("#end td").each(function(key,val){
var s=0;
$(".su").each(function(k,v){
s+=parseInt($(v).children("td").eq(key).html());
});
$(this).html(s);
});
})
</script>
</head>
<body>
<table id="tbStu" >
<tr id="exe">
<th>dddd</th><th>sss</th><th>ffff</th><th>ddsss</th>
</tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr class="su"><td>1</td><td>2</td><td>4</td><td>1</td></tr>
<tr id="end"><td>333</td><td>4444</td><td>5555</td><td>66666</td></tr>
</table>
</body>
</body>
</html>
补充:Java , Web 开发