【发布时间】:2013-07-31 03:27:37
【问题描述】:
我有选择字段
<select id="select" required name="bank" >
<option value="cash">Cash</option>
<option value="debit">Debit Card</option>
<option value="cc">Credit Card</option>
</select>
以及显示价格的文本字段
<input type="text" id="sub_total" name="sub_total">
<input type="text" id="fee" name="fee">
<input type="text" id="sum" name="total">
和javascript
var total = 0;
var fees = 0;
var total_fees = fees + total;
$("#sub_total").val(total);
$("#fee").val(fees);
$("#sum").val(total_fees);
所以关键是如果选择信用卡,我想将“费用”值从“0”更改为“0.1 或任何我想要的”
伪解码是
如果选择抄送 var 费用 = '0.1'; 别的 var 费用 = '0';
【问题讨论】:
标签: javascript jquery html math