JavaScript always counts from 0 on arrays and object lists.
"'document.form1.status' is null or not an object"
This indicates that you forgot to change the names in the html to match the change in the JavaScript. You were supposed to rename your html objects so they have the same name "status" instead of having the names "status1" and "status2".
Hello...
Okay the code is working, except on single inputbox situation.
I use the
document.form1.sum.length to set the looping limitation.
The problem is when there is only one inputbox, the total is always equal to 0.
function add(){
var i, d, e;
e = 0;
for(i=0;i<document.form1.sum.length;i++){
if(document.form1.status[i].checked)
document.form1.hidsum[i].value=document.form1.sum[i].value;
else document.form1.hidsum[i].value=0;
a=document.form1.hidsum[i].value;
e = e + parseInt(a);
};
document.form1.total.value=e;
};
Please help me with this, thanks.....