Javascript:总结表的列 [英] Javascript: Sum up columns of a table

查看:54
本文介绍了Javascript:总结表的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我设置了一个简单的表,用户可以在框中插入值,并在onkeydown上汇总列。


表:

Hi all,

I have a simple table set up in which a user can insert values into the boxes and onkeydown it will sum up the column.

Table:

展开 | 选择 | Wrap | 行号

推荐答案

嗨...


我刚刚改变了你的代码的一部分......这是对列进行求和的一种方法..你可以在n ...中找到总和的方法... 。


HTML代码

Hi...

I have just changed some part of your code.... This is one way of summing the column.. you can work in n no.. of ways to find the sum...

HTML Code

展开 | 选择 | Wrap | 行号


非常感谢这很好地完成了这项工作:)
Thank you very much that does the job nicely :)


唉!第10行不需要eval - parseInt会很好地加起来。
Ugh! No need for the eval on line 10 - the parseInt will add up nicely.


这篇关于Javascript:总结表的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆