请用jquery帮我做个如下的表格
发布网友
发布时间:2022-04-23 03:05
我来回答
共2个回答
热心网友
时间:2022-04-23 04:35
<html>
<table border="1">
<tr>
<td></td><td>次数</td><td>时长</td>
</tr>
<tr>
<td>呼入</td><td name="num1">15</td><td name="num2">522</td>
</tr>
<tr>
<td>呼出</td><td name="num1">52</td><td name="num2">123</td>
</tr>
<tr>
<td>合计</td><td id="count1">52</td><td id="count2">123</td>
</tr>
</table>
<script type="text/javascript">
var num1 = document.getElementsByName("num1");
var num2 = document.getElementsByName("num2");
var count1 = 0;
var count2 = 0;
for(var i =0;i<num1.length;i++){
count1 += parseInt(num1[i].innerHTML);
count2 += parseInt(num2[i].innerHTML);
}
document.getElementById("count1").innerHTML = count1;
document.getElementById("count2").innerHTML = count2;
</script>
</html>
热心网友
时间:2022-04-23 05:53
什么意思,只是用于计算合计?追问恩, 合计那个应该怎么写