<html>
<head>
<title>多列求和</title>
<script type="text/javascript">
function addAll(){
var total_value=0;
for(i=0;i<document.myform.check.length;i++){
if(document.myform.check[i].checked){
total_value+= parseInt( document.myform.money[i].value );
}
}
alert(total_value);
document.getElementById("total").value = total_value; } </script> </head>
<body>
<form action="" method="post" name="myform">
<table border="1" cellpadding="0" cellspacing="0" width="20%" height="40%">
<tr>
<td>金额</td>
<td>是否求和</td>
</tr>
<tr>
<td><input type="text" name="money" /></td>
<td><input type="checkbox" name="check" /></td>
</tr>
<tr>
<td><input type="text" name="money" /></td>
<td><input type="checkbox" name="check" /></td>
</tr>
<tr>
<td><input type="text" name="money" /></td>
<td><input type="checkbox" name="check" /></td>
</tr>
<tr>
<td><input type="text" name="money" /></td>
<td><input type="checkbox" name="check" /></td>
</tr>
<tr>
<td><input type="button" value="求和" onclick="addAll()" /></td>
<td><input type="text" id="total" readonly /></td>
</tr> </table> </form> </body>
</html>

HTML--JS 多列求和的更多相关文章

  1. bootstrap table 列求和

    <div class="modal fade in" id="_modalDialog" tabindex="1" role=&quo ...

  2. struts2标签之列求和

    struts2标签之列求和 <table width="100%" border="0" cellpadding="0" cellsp ...

  3. jquery 列求和

    列求和 var m = 0; $('#tb tr').each(function () { //td:eq(3)从0开始计数 $(this).find('td:eq(3)').each(functio ...

  4. linux对文件某列求和

    对文件某列求和: -F,用,号分隔,求第3行的和 awk -F,  '{sum += $3};END {print sum}' test

  5. sql server 某一列求和

    sql server 某一列求和 SELECT 患者来源,设备类型,检查部位,设备名称,convert(char(10),STUDY_DATE,121) as 日期, count(distinct 就 ...

  6. [VBA]指定列求和

    ##指定列求和 需求: 求和:列为“销售金额”的数值 Sub 求和()Dim i As Integer, j As IntegerFor i = 3 To 56For j = 15 To 81 Ste ...

  7. vue表格之:summary-method="getSummaries"与show-summary(列求和)

    //表格列求和 <el-table :summary-method="getSummaries" show-summary></el-table> getS ...

  8. pandas对列求和

    了解更多,请关注公众号"轻松学编程" 一行代码实现对列求和 使用pandas把列表中的字典元素转成二维数组,然后使用pandas函数实现对每一列求和. 代码: import pan ...

  9. Java lambda 分组后多列求和

    主要思路是reducing,可以像sql一样分组后多列求和处理成新对象等: select code,max(name)as name,sum(chengJi)as chengJi,sum(age)as ...

随机推荐

  1. HDFS中DataNode工作机制

    1.DataNode工作机制 1)一个数据块在datanode上以文件形式存储在磁盘上,包括两个文件,一个是数据本身,一个是元数据(包括数据块的长度,块数据的校验和,以及时间戳). 2)DataNod ...

  2. RocksDB解析

    0. 存储引擎基础 存储引擎的基本功能和数据结构 一个存储引擎需要实现三个基本的功能: write(key, value)                                       ...

  3. git Windows终端安装教程

    1.下载网址:https://gitforwindows.org/ 2.双击压缩包出现: 3.点击下一步后,选择安装路径: 根据自己的需求选择路径 4.选择安装的组件,建议全选 [每一条解析:] Ad ...

  4. javascript事件触发器fireEvent和dispatchEvent

    javascript事件触发器fireEvent和dispatchEvent   事件触发器就是用来触发某个元素下的某个事件,IE下fireEvent方法,高级浏览器(chrome,firefox等) ...

  5. ES6——generator

    generator 生成器函数 普通函数,一路到底 generator函数,中间可以停,到哪停呢,用 yield 配合,交出执行权 yield 有 放弃.退让.退位的意思 需要调用next()方法启动 ...

  6. 2018-8-10-C#-ValueTuple-原理

    title author date CreateTime categories C# ValueTuple 原理 lindexi 2018-08-10 19:16:52 +0800 2018-2-13 ...

  7. linux查看 inotify 提供的工具

    [root@rsync-client-inotify ~]# ll /usr/local/bin/inotify* -rwxr-xr-x. 1 root root 38582 Jun 3 22:23 ...

  8. wangeditor 支持上传视频版

    1.关于使用哪个富文本编辑器. 简单的要求,不要求发布出来的文章排版要求很高.  可用wangediter.(简单,体积小,不可修改上传图片的尺寸大小) 转载 来源: https://blog.csd ...

  9. TPS、QPS和系统吞吐量的区别和理解

    参考:https://blog.csdn.net/u010889616/article/details/83245695 一.QPS/TPSQPS:Queries Per Second意思是“每秒查询 ...

  10. RedHat Linux6.4下安装apache服务

    一.换yum 原因:安装apache2.4是需要安装apr . apr-util .pcre.httpd四个包, 在安装pcre包时会报错: configure: error: You need a ...