Pooja Chowdhury

Pooja Chowdhury

  • NA
  • 396
  • 39.7k

tax calculation

Aug 1 2017 3:48 AM
javascript:
  1. function taxCalc()  
  2. {  
  3. var _txt1 = document.getElementById('<%= txtPremamnt.ClientID %>');  
  4. var _txt2 = document.getElementById('<%= txtSrvtax.ClientID %>');  
  5. var _txt3 = document.getElementById('<%= txtTotamnt.ClientID %>');  
  6. var t1=0, t2=0;  
  7.   
  8. if(_txt1.value != "") t1=_txt1.value;  
  9. if(_txt2.value != "") t2=_txt2.value;  
  10.   
  11. _txt3.value = parseInt(t1) + (parseInt(t1) * (parseInt(t2) / 100));  
  12. }  
  1. <asp:TextBox ID="txtPremamnt" runat="server" onkeypress="taxCalc();" class="form-control " placeholder="Pre. Amt"></asp:TextBox>  
  2.    
  3. <asp:TextBox ID="txtSrvtax" runat="server" placeholder="Srv. Tax" class="form-control "></asp:TextBox>  
  4.    
  5. <asp:TextBox ID="txtTotamnt" runat="server" placeholder="Tot. Amt" class="form-control "></asp:TextBox>  
OUTPUT:
 
Pre. Amt:1000 
Tax: 10
Total:110
 
when I changed
 
Pre. Amt:1000
Tax: 10
Total:1100
 
Please check this

Answers (3)