Well with some help I got the totaling to work...but I have another column that says how many left they can get, and I want it to subtract the ammount they put into the first field from the ammount in the canget field corresponding to it.


So I tried to do the below, it won't total anymore, and it won't do the subtracting...

Code:
<script type="text/javascript">
 
var item_ids = ['1','5','7','15','27']
 
function total(oForm)
{ 
 var i = 0, vtemp = 0, vresult = 0, vresult2 = 0;
 for (i; i < item_ids.length; i++)
 {
  vtemp = Number(oForm.elements['amount' + item_ids[i]].value);
  if (!isNaN(vtemp))
   vresult += vtemp;
   vresult2 -= vtemp;
  else oForm.elements['amount' + item_ids[i]].value = ''; //optional, clears invalid entry
 } 
 oForm.elements.total2.value = vresult;
 oForm.elements['canget' + i].value = vresult2;
}
</script>