【问题标题】:summing up number on offline html总结离线html上的数字
【发布时间】:2014-08-31 08:45:01
【问题描述】:

我有一个 66 MB 的巨大 html 文件,我什至没有足够的能力在电子表格中打开它。 必须汇总一列才能获得一次性付款。 我复制并粘贴了一个 js 代码来进行计算,但它不起作用。 有人可以帮我工作吗?指出错误。 firebug 显示没有错误

<!-- language: lang-js -->
    <script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"/>
    <script type="text/javascript">
        $(document).ready(function() {
            var total_figure = 0;
            $("td.aws_figure").each(function() {
                total_figure += parseInt($(this).text(), 10);
            });
            $("label#total").html(total_figure);
            console.log(total_figure);
        });
    </script>

【问题讨论】:

  • jsfiddle
  • 你的html代码在哪里?您遇到了什么控制台错误?
  • 您使用的是html5或低于html5的版本?
  • 你的第一个脚本标签需要一个结束&lt;/script&gt;

标签: jquery jquery-calculation


【解决方案1】:

像这样关闭脚本标签。 Script tag is not a self closable tag.

<script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>

【讨论】:

  • 谢谢,你把我从地狱里救了出来。
  • @user3823852 - 很高兴为您提供帮助。干杯!
猜你喜欢
  • 1970-01-01
  • 2020-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-17
  • 1970-01-01
  • 1970-01-01
  • 2016-05-02
相关资源
最近更新 更多