私のコードでは、関数全体が1回実行されているということは、それらがブレークポイントではないことを意味します。プログラムはこのように実行され、最初のテキストボックスに値を入力すると、作成したすべてのテキストボックスに0が表示されます。私が何をしているのか教えてください。私のコーディングは次のとおりです。
<html>
<head>
<title>Puchase Recipt</title>
<script type="text/javascript">
function recipt()
{
var a = Number(document.f1.amount.value);
var b = Number(document.f1.quantity.value);
var pro = a*b;
if (pro > 100)
{
var c = Number(document.f1.discount.value);
var per = Number(pro * c / 100);
var d = Number(document.f1.subtract.value);
document.f1.subtract.value = per;
}
var e = Number(document.f1.total.value);
var total = pro - per;
document.f1.total.value = total;
}
</script>
</head>
<body>
<h1>Purchase Recipt</h1>
<table border="1" bordercolor="#000099">
<form name="f1">
<tr>
<th>Amount per KG</th>
<td><input type="text" placeholder="Amount" name="amount" onChange="recipt()"/></td>
</tr>
<tr>
<th>Quntity of item</th>
<td><input type="text" placeholder="Quantity" name="quantity" onChange="recipt()"/></td>
</tr>
<tr>
<th>Discount in %</th>
<td><input type="text" placeholder="Discount" name="discount" onChange="recipt()"/></td>
</tr>
<tr>
<th>Deduct Amount</th>
<td><input type="text" placeholder="Deduct Amount" name="subtract" onChange="recipt()"/></td>
</tr>
<tr>
<th>Total Amount</th>
<td><input type="text" placeholder="Total Amount" name="total" onChange="recipt()"/></td>
</tr>
<th>Reset</th>
<td><input type="reset"/></td>
</tr>
</form>
</table>
</body>
</html>