这是我的脚本:
<script>
jQuery(document).ready(function () {
jQuery('#btnCalculate').click(function () {
var salaries = parseInt(jQuery('#txtEmployeeSalaries').val(), 10);
var nationalInsurance = parseInt(jQuery('#txtENIC').val(), 10);
var pensionCont = parseInt(jQuery('#txtEPC').val(), 10);
var expenses = parseInt(jQuery('#txtAnyExpenses').val(), 10);
var income = parseInt(jQuery('#txtIncome').val(), 10);
var labourCost = (((salaries + nationalInsurance + pensionCont + expenses) / (income)) * 100);
alert(labourCost);
jQuery('#txtTotal').val(labourCost).toFixed(2);
});
});
</script>
但是在 Chrome 控制台中它指出:
Uncaught TypeError: Object [object Object] has no method 'toFixed'
有人看到这有什么明显的问题吗?