This is my first attempt at incorporating javascript into my webapp other than one other canned script.
I have a webform in ASP.net VB. On the form I have a checkbox and when that checkbox is checked I want it to prompt the user for a qty, I then want it to subtract that quantity from a quantity in another textbox filled on form load db query. My taqty is not getting the quantity from txtQtyAcc, with error Unable to get value of property 'value': object is null or undefined. I'm also seeing an error for the calculated quantity haqty variable that it is undefined. I'm not sure what I'm missing. I've checked all the similar questions without finding a solution.
var taqty = document.getElementById('<%= txtQtyAcc.ClientId %>').value;
var rejqty = prompt("Enter Reject Qty", "0");
var haqty = taqty.value - rejqty;
function rQty() {
if (rejqty != null) {
document.getElementById('<%= txtQtyRej.ClientID %>') = rejqty.value.toString;
taqty.value = haqty.value.toString
}
}
I'm calling the script from code behind for the checkbox.checkedchanged event.
ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "rQtyFunction", "rQty();", True)