zoukankan      html  css  js  c++  java
  • TextBox文本中的数值相加(JavaScript)

    <script type="text/javascript">
                                      function Sumtxt(obj)
                                            {
                                                var strtxt1 =obj.value;
                                                var objtxt3 = document.getElementById("txtTotal");
                                                var tot=parseInt(objtxt3.value);
                                                tot += parseInt(strtxt1);
                                                objtxt3.value=tot;
                                            } 
    </script>
    HTML代码:
     <asp:TextBox ID="txtArea" runat="server" Width="40px" onblur="Sumtxt(this)"></asp:TextBox>
     <asp:TextBox ID="txtTotal" runat="server" Width="40px" Text="0"></asp:TextBox>
    对每一个textbox控件添加:onblur="Sumtxt(this)",在结果文本框中初始化数字‘0’
    Top
    收藏
    关注
    评论
  • 相关阅读:
    一次开发中使用过的shell命令
    MySQL 数据库 Having 和Where的区别
    mysql 正则表达式
    mysql union与 union all 的区别
    压缩与解压
    MySQL Shell
    MGR监控报警
    MySQL Router单点隐患通过Keepalived实现
    expdp和impdp
    ogg trail文件序列号不一致
  • 原文地址:https://www.cnblogs.com/judypol/p/1547139.html
Copyright © 2011-2022 走看看