Tuesday, January 28, 2014

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

SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...