You can easily calculate any mathematical expression in JavaScript using the senerio. // get element by id value for calculation var NoOfDays = parseFloat(NoOfDays); var MnyGrossSalary = parseFloat(MnyGrossSalary); var ServiceBenefitDay = parseFloat(ServiceBenefitDay); var EarnLeaveDepositedToCompany = parseFloat(EarnLeaveDepositedToCompany); // Calculate your mathematical Expression var totalBenefitDayAmount = ServiceBenefitDay * (MnyGrossSalary / NoOfDays); var totalEarnLeaveAmount = EarnLeaveDepositedToCompany * (MnyGrossSalary / NoOfDays); // Set value of your mathematical expression in your desire html control by id document.getElementById('ServiceBenifitPayment_TotalBenefitDayAmount').value = parseFloat(totalBenefitDayAmount, 10).toFixed(2); document.getElementById('ServiceBenifitPayment_TotalEarnLeaveAmount').value = parseFloat(totalEarnLeaveAmount, 10).toFixed(2);
Work smarter, not harder.