I am trying to perform a calculation on a web form that will take two seperate quantities plus them together and then multiplied by the quantity to end up with the total cost for that item. The snippet of the calculation i am using at the moment is as follows:
now this calculation does work in a way, but not the correct way. I have discovered that for some strange reason qa and qb are no added together but put together to form one number, for example if qa = 1 and qb = 2 the result would be 12 instead of 3
Any ideas why this is happening?
Code:
if (document.form1.qa.value > "")
{ qa = document.form1.qa.value };
document.form1.qa.value = eval(qa);
if (document.form1.qb.value > "")
{ qb= document.form1.qb.value };
document.form1.qb.value = eval (qb);
tq = qa + qb;
document.form1.tq.value = dm(eval(tq));
totala = tq * cost;
document.form1.totala.value = dm(eval(totala));
now this calculation does work in a way, but not the correct way. I have discovered that for some strange reason qa and qb are no added together but put together to form one number, for example if qa = 1 and qb = 2 the result would be 12 instead of 3
Any ideas why this is happening?