calculating grand total
I'm doing a school project and I'm trying to add up several text boxes, however some of them are blank and when I calculate them I get a NaN result. Here is my code:
qty1= parseFloat(document.form1.qty_prt.value)
qty2= parseFloat(document.form1.qty_mon.value)
qty3= parseFloat(document.form1.qty_comp.value)
sub_tot=parseFloat(document.form1.subt.value)
tax_tot=parseFloat(document.form1.tax.value)
grand_tot=parseFloat(document.form1.grandt.value)
qty_tot=eval(qty1+qty2+qty3)
alert("quantity is " + qty_tot)
|