HTML 代码示例:超市购物结算系统
超市购物结算
<script>
function calculation() {
var shampooPrice = parseInt(document.getElementById('shampoo').value);
var instantNoodlesPrice = parseInt(document.getElementById('instantNoodles').value);
var penPrice = parseInt(document.getElementById('pen').value);
var totalPrice = shampooPrice + instantNoodlesPrice + penPrice;
document.getElementById('totalPrice').value = totalPrice;
var receivedMoney = 100;
var change = receivedMoney - totalPrice;
document.getElementById('change').value = change;
}
</script>
原文地址: https://www.cveoy.top/t/topic/njnO 著作权归作者所有。请勿转载和采集!