Hi I have these JS functions:
If the CalculateVlaues() function is triggered, I get an Object required error on the closed prent on top of the function name. Aand if the Reset() function is called I get the same error on the close prent on top of function name too. I verified the variables and field names in the functions, they seem to be all valied.
Pleas help.
function AdjustValues(which,txtValue)
{
var Qty=which.value;
var PrevTotal=document.getElementById('txtTotal').value * 1;
var PrevSubTotal=document.getElementById('txtSubTotal').value * 1;
var ItemSubTotal=document.getElementById(txtValue+'Total').value * 1;
var PrevQtyOnHand=document.getElementById(txtValue+'QtyOnHand').value * 1;
var unitprice=document.getElementById(txtValue+'UPrice').value * 1;
var NewQtyOnHand=PrevQtyOnHand + Qty;
document.getElementById(txtValue+'QtyOnHand').value = NewQtyOnHand;
document.getElementById(txtValue+'Total').value = 0;
document.getElementById('txtSubTotal').value = PrevSubTotal - ItemSubTotal;
document.getElementById('txtTotal').value = PrevTotal - ItemSubTotal;
return (true);
}
function CalculateVlaues()
{
var CurrTotal=document.getElementById('txtTotal').value * 1;
var Discount = 1-((document.getElementById('txtDiscount').value * 1)/100);
var ExtraCharges = parseInt(document.getElementById('txtExtraCharge').value * 1);
var DiscountAmt = (CurrTotal * Discount);
var NewTotal=(CurrTotal - DiscountAmt) + ExtraCharges;
document.getElementById('txtTotal').value = NewTotal;
return (true);
}
function Reset()
{
var CurrTotal=document.getElementById('txtTotal').value * 1;
var Discount = 1-((document.getElementById('txtDiscount').value * 1)/100);
var ExtraCharges = parseInt(document.getElementById('txtExtraCharge').value *1);
var NewTotal=(CurrTotal - ExtraCharges)/ Discount;
document.getElementById('txtTotal').value = NewTotal;
return (true);
}
Thanks.
Mo
If the CalculateVlaues() function is triggered, I get an Object required error on the closed prent on top of the function name. Aand if the Reset() function is called I get the same error on the close prent on top of function name too. I verified the variables and field names in the functions, they seem to be all valied.
Pleas help.
function AdjustValues(which,txtValue)
{
var Qty=which.value;
var PrevTotal=document.getElementById('txtTotal').value * 1;
var PrevSubTotal=document.getElementById('txtSubTotal').value * 1;
var ItemSubTotal=document.getElementById(txtValue+'Total').value * 1;
var PrevQtyOnHand=document.getElementById(txtValue+'QtyOnHand').value * 1;
var unitprice=document.getElementById(txtValue+'UPrice').value * 1;
var NewQtyOnHand=PrevQtyOnHand + Qty;
document.getElementById(txtValue+'QtyOnHand').value = NewQtyOnHand;
document.getElementById(txtValue+'Total').value = 0;
document.getElementById('txtSubTotal').value = PrevSubTotal - ItemSubTotal;
document.getElementById('txtTotal').value = PrevTotal - ItemSubTotal;
return (true);
}
function CalculateVlaues()
{
var CurrTotal=document.getElementById('txtTotal').value * 1;
var Discount = 1-((document.getElementById('txtDiscount').value * 1)/100);
var ExtraCharges = parseInt(document.getElementById('txtExtraCharge').value * 1);
var DiscountAmt = (CurrTotal * Discount);
var NewTotal=(CurrTotal - DiscountAmt) + ExtraCharges;
document.getElementById('txtTotal').value = NewTotal;
return (true);
}
function Reset()
{
var CurrTotal=document.getElementById('txtTotal').value * 1;
var Discount = 1-((document.getElementById('txtDiscount').value * 1)/100);
var ExtraCharges = parseInt(document.getElementById('txtExtraCharge').value *1);
var NewTotal=(CurrTotal - ExtraCharges)/ Discount;
document.getElementById('txtTotal').value = NewTotal;
return (true);
}
Thanks.
Mo