JQuery 动态求和的方法
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

HTML 代码:
<table border="1" cellspacing="0"> <thead> <th></th> <th>语文</th> <th>数学</th> <th>英语</th> <th>总分</th> </thead> <tbody> <tr> <td></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td id="row1"></td> </tr> <tr> <td></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td><input type="text" placeholder="--" onkeyup="total()"></td> <td></td> </tr> <tr> <td>合计</td> <td id="col1"></td> <td></td> <td></td> </tr> </tbody> </table>JQuery 代码:
function total(){ var colTotal = 0; var rowTotal = 0; // 计算列和 $('table tr:gt(0)').each(function(){ if(parseFloat($(this).find('td:eq(1) input[type="text"]').val())){ colTotal += parseFloat($(this).find('td:eq(1) input[type="text"]').val()); } }); $('#col1').text(colTotal); // 计算行和 $('table tr:eq(1) td input[type="text"]').each(function(){ if(parseFloat($(this).val())){ rowTotal += parseFloat($(this).val()); } }); $('#row1').text(rowTotal); }猜你可能想看的VPS
- STSDUST→30.55 元 月 384MB 内存 5GB 空间 50虚拟空间(主机)
- 送美元 RackNerd 春节促销→登陆 购买最高送$188 红包 独立独立服务器[U]
- 活动 OLVPS→充值 100 元送 10 元 最多送 100 元 国内全球[VPS测评]
- 线路一般-SnowVPS→$18 年 2T 流量 美国芝加哥服务器美国VPS[主机]
- 看奈飞 99 元 月 1G 内存 10G 硬盘 1T 流量 300Mbp全球[VPS测评]
- X4B→主打 DDOS 防护 有日本 新加坡 洛杉矶 德国等节点 50G日本VPS[主机]
- 超便宜 Hostsailor→特价独立服务器 4 折优惠 抗投放 免费 独立服务器[U]
- 真实测评 恒星云→香港沙田 CN2 线路 1 核 1G 40G 1M 套香港VPS[主机]
- AlphaVPS→€15 年 512MB 内存 128GB 空间 500虚拟空间(主机)
- 便宜 RAKsmart→圣何塞不限流量服务器 46 美元起 站群服务器买站群服务器[IP]
- DogYun 动态云全场 8 折 经典云香港 CMI 月付 39 元起香港VPS[主机]
- 数脉科技→366 元 月 E3-1230v2 16GB 内存 1TB 或香港VPS[主机]
- nexusbytes→大硬盘 VPS $38 年 KVM 512m 内存全球[VPS测评]
- RebelHositng→$25 月-L5639 16GB 1TB 10全球[VPS测评]
- [11.11]HostXen→充 300 送 100 续费减 10 元 全球[VPS测评]
- 限时抢购 CloudCone→1G 内存 20G 硬盘 2T 流量年付$全球[VPS测评]
- 便宜 $2 月 512M 内存 20G SSD 1Gbps 不限流量 K全球[VPS测评]
- 搬瓦工 $29.88 年 2G 内存 40G SSD 1T 流量 KVM全球[VPS测评]
- 腾讯云双 12 促销云服务器到底怎么样 2 核 4G6M1499 元 3全球[VPS测评]
- 新商家慎重-dogyun→VPS 低至 6.5 折 低至 21 元 月 日本VPS[主机]
- 腾讯云服务器双 11 秒杀最后一天 国内 香港云服务器 268 元 3 香港VPS[主机]
- 如何合理地设置WordPress文章延伸阅读或文章超链接全球[VPS测评]
- ZJI重新上架香港多IP站群便宜服务器,238个IPv4,月付1400元站群服务器[IP]
- baehost-阿根廷 1c1g50gb 不限流量 9刀 月全球[VPS测评]
- Olvps → 256M内存 5G 储存 512G流量 30Mbps 全球[VPS测评]
- 推荐! Virmach → 1C 512M RAM 15G SSD 25全球[VPS测评]
- centos7如何查看firewall防火墙状态:开启/关闭/重启防火墙全球[VPS测评]
- wikihost,微基主机服务,100M带宽香港CMIVPS,5G防御,香港VPS[主机]
- Ubuntu关机命令是什么?Ubuntu关机命令介绍全球[VPS测评]
- CombCloud,香港沙田CN2VPS测评,2核1G52元/月,安畅C香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-208095.html











