I am having hard time with the code below. I tworks in Netscape but generates a JavaScript error in Explorer 4.0. In particular it says that document.form1.elements is not an object!
What I am trying to do is add together the quantities in a varaiable number of textboxes which the user enters and then put them in the qt field. The len variable gives us the number of textboxes. The function is triggered by an ONCHANGE event in the textboxes so that as the user tabs from one field to another the qt field is updated.
function add() {
sum=0;
len=document.form2.size_array.value.split(",".length
for (i=0; i<len; ++i){
if (document.form1.elements.value == ""{document.form1.elements.value = "0"
}
sum+=eval(document.form1.elements.value)
}
document.form1.qt.value=sum.toString()
}
Thank you for helping out on this.
Hoss
What I am trying to do is add together the quantities in a varaiable number of textboxes which the user enters and then put them in the qt field. The len variable gives us the number of textboxes. The function is triggered by an ONCHANGE event in the textboxes so that as the user tabs from one field to another the qt field is updated.
function add() {
sum=0;
len=document.form2.size_array.value.split(",".length
for (i=0; i<len; ++i){
if (document.form1.elements.value == ""{document.form1.elements.value = "0"
}
sum+=eval(document.form1.elements.value)
}
document.form1.qt.value=sum.toString()
}
Thank you for helping out on this.
Hoss