calculate mathematical operation in javascript by html id

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);  

Popular posts from this blog

WPF Crystal Report Viewer Using SAP

mvc razor textboxfor change event change another textboxfor value

ASP.NET MVC razor SAP Crystal report