how to do operation (minus) on a html table with inputs in the cells

how to do operation (minus) on a html table with inputs in the cells

hi friend i have this sample working:


if you write some number on the column of qty2  it react. but i have a error the ids are same (duplicated):

qty3=qty1-qty2

noCajas1
noCajas2
noCajas3

i changed it to:
row1: noCajas1_1
          noCajas1_2
          noCajas1_3
row2: noCajas2_1
          noCajas2_2
          noCajas2_3
and so on...


this operation: qty3=qty1-qty2    not work anymore, how to fix?

and.................. if user write a char: A   the result is NaN how to prevent it and alert with a errror?

thanks.