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位小数。
时间: 2024-10-12 11:10:44