js 两数相减

var SecondPrice = document.getElementById("txtSecondPrice");  //秒杀价
            var MarketPrice = document.getElementById("txtMarketPrice");  //市场价
            var SavePrice = document.getElementById("txtSavePrice");      //节省价
       
            SavePrice.value  = Math.round((parseFloat(MarketPrice.value) - parseFloat(SecondPrice.value))*100)/100;//保留2位小数。

原文地址:https://www.cnblogs.com/jkyweb/p/4503316.html