- Input variables :
- Quantity1 = TextBox2.Text
- Quantity2 = Label1.Text
- Quantity3 = Label2.Text
Output :
- TextBox3.Text
2. Call in Textbox
<asp:TextBox ID="TextBox4" runat="server" AutoComplete="off" onclick="fillTextbox4()"></asp:TextBox>
3. Javascript Code run when page loads [ triggered at txt1 change ]
<script type="text/javascript">
function fillTextbox4() {
var txt1 = parseFloat(document.getElementById('<%= TextBox1.ClientID %>').value) || 0;
var opn = parseFloat(document.getElementById('<%= Label3.ClientID %>').innerText) || 0;
var total = txt1-opn ;
// Set the sum in TextBox4
document.getElementById('<%= TextBox4.ClientID %>').value = total;
}
window.onload = function () {
document.getElementById('<%= TextBox1.ClientID %>').addEventListener("input", fillTextbox4);
};
</script>
Learn more about cryptography