zoukankan      html  css  js  c++  java
  • js求和

    function GetTotal() {
                var traveltotal = document.getElementById("ctl00_PlaceHolderMain_lstTravel_txtTravelReportTotal").value;
                var DailyTotal = document.getElementById("ctl00_PlaceHolderMain_lstDaily_txtDailyReportTotal").value;
                var OthersTotal = document.getElementById("ctl00_PlaceHolderMain_lstExpenseBusiness_txtOthersTotal").value;
                var total = document.getElementById("ctl00_PlaceHolderMain_txtTotalExpense").value;
                traveltotal = parseFloat(traveltotal.replace(/,/g, ""));
                DailyTotal = parseFloat(DailyTotal.replace(/,/g, ""));
                OthersTotal = parseFloat(OthersTotal.replace(/,/g, ""));//去除千分位
                if (!isNaN(traveltotal))
                    total = traveltotal;
                if (!isNaN(DailyTotal))
                    total = total + DailyTotal;
                if (!isNaN(OthersTotal))
                    total = total + OthersTotal;
                document.getElementById("ctl00_PlaceHolderMain_txtTotalExpense").value = total.toFixed(2);
                Change();
            }
            function Change() {
                var Cashtotal = document.getElementById("ctl00_PlaceHolderMain_txtCash").value;
                var total = document.getElementById("ctl00_PlaceHolderMain_txtTotalExpense").value;
                total = parseFloat(total.replace(/,/g, ""));
                Cashtotal = parseFloat(Cashtotal.replace(/,/g, ""));
                var differential
                if (!isNaN(total)) {
                    if (!isNaN(Cashtotal)) {
                        differential = total - Cashtotal;
                        differential = parseFloat(differential);
                        if (differential < 0) {
                            document.getElementById("ctl00_PlaceHolderMain_txtDUEASIMCO").value = -differential.toFixed(2);
                            document.getElementById("ctl00_PlaceHolderMain_txtDUEEMPLOYEE").value = "";
                        }
                        else {
                            document.getElementById("ctl00_PlaceHolderMain_txtDUEASIMCO").value = "";
                            document.getElementById("ctl00_PlaceHolderMain_txtDUEEMPLOYEE").value = differential.toFixed(2);
                        }
                    }
                }
            }

  • 相关阅读:
    线段树(updata+query)
    铁轨(栈)
    困难的串(搜索)
    素数环(简单搜索)
    编码
    opencv + numpy for python
    PIL参考手册
    八数码问题
    三维地图(BFS)
    梯田(dfs)
  • 原文地址:https://www.cnblogs.com/GreenGrass/p/3044338.html
Copyright © 2011-2022 走看看