超市购物结算

超市购物结算











<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>
使用html语言写个代码:小丽去超市采购日用品她购买了洗发水方便面签字笔3种商品各1份给售货员100元售货员进行找零。请用代码描述这个业务要求从键盘录入商品的价格输出总价格和找零。训练点变量的定义和使用输入输出操作。

原文地址: https://www.cveoy.top/t/topic/bWBL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录