function calcAmnt() var text1 = document.getElementById('<%= txt_qty_OS.ClientID %>'); var text2 = document.getElementById('<%= txt_rate_OS.ClientID %>'); var txt_amnt = document.getElementById('<%= txt_amt_OS.ClientID %>'); if (text1.value.length == 0) { text1.value = 0; } if (text2.value.length == 0) { text2.value = 0; } var x = parseFloat(text1.value); var y = parseFloat(text2.value); txt_amnt.value = x * y; if (txt_amnt.value == "NaN") txt_amnt.value = 0; }
<table class="sTable"> <tr> <td class="sTD_R"> Quantity: </td> <td> <asp:TextBox ID="txt_Qty_OS" runat="server" Height="20px" onChange ="calcAmt()" width="167px">0</asp:TextBox> </td> </tr> <tr> <td class="sTD_R"> Rate: </td> <td> <asp:TextBox ID="TXT_RATE_OS" runat="server" Height="20px" OnChange ="calcAmt()" width="167px">0</asp:TextBox> </td> </tr> <tr> <td class="sTD_R"> Amount: </td> <td> <asp:TextBox ID="TXT_AMT_OS" runat="server"Class="textbox" Height="22px" Width="165px">0</asp:TextBox> </td> </tr> </table>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)