I am working on a asp.net Web Application. What I want to do in this program is there are three textboxes. When user enter the integer in TextBox1 and TextBox2, it will automatically display the multiplication result in TextBox3. I am not sure how should I do this, this is my code.
JavaScript Code
<script type="text/javascript">
function multiply() {
var txt1 = document.getElementById('<%= TextBox1.ClientID %>')
var txt2 = document.getElementById('<%= TextBox2.ClientID %>')
var result = txt1.ToString() * txt2.ToString();
var rstTxtbox = document.getElementById('<%= TextBox3.ClientID %>')
rstTxtbox = result.toString();
}
</script>
Html:
<div>
<table>
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td style="text-align:center">
x
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label1" runat="server" Text="Result = "></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>