arcmax
03-20-2005, 06:37 AM
Hi
I got this script from the forum..
<!--
function getVal(){
var doc = document['oFrm'];
doc['tot'].value = ((doc['AMT1'].value)/1) + ((doc['AMT1'].value)/1);
}
}
//-->
</script>
.........
Print("<form METHOD=\"POST\" ACTION=\"index2.html\" name=\"oFrm\">\n");
.......
<input type=\"textbox\" size=\"5\" id=\"AMT$i\" name=\"AMT$i\" size=\"12\" onkeyup=\"javascript:getVal();\" onkeydown=\"javascript:getVal();\">
...
<input id=\"tot\" name=\"tot\" size=\"12\" readonly></font>
</form>
This scvript works for the first two text boxes in the form.
What modification would I need to do so that lets say I have 26 text boxes that need to be totaled...amt1,amt2...amt26...
I know a for loop would be good but I have tried adding a for loop and i keep getitng it worng.. getting things concatinated instead of adding things up...
Need some very urgen help...i know its simple but i think i am not too familiar with the rules of javascriting/c++ hence a poblem implimenting or chnigng the script.
Thanks
Apurva
I got this script from the forum..
<!--
function getVal(){
var doc = document['oFrm'];
doc['tot'].value = ((doc['AMT1'].value)/1) + ((doc['AMT1'].value)/1);
}
}
//-->
</script>
.........
Print("<form METHOD=\"POST\" ACTION=\"index2.html\" name=\"oFrm\">\n");
.......
<input type=\"textbox\" size=\"5\" id=\"AMT$i\" name=\"AMT$i\" size=\"12\" onkeyup=\"javascript:getVal();\" onkeydown=\"javascript:getVal();\">
...
<input id=\"tot\" name=\"tot\" size=\"12\" readonly></font>
</form>
This scvript works for the first two text boxes in the form.
What modification would I need to do so that lets say I have 26 text boxes that need to be totaled...amt1,amt2...amt26...
I know a for loop would be good but I have tried adding a for loop and i keep getitng it worng.. getting things concatinated instead of adding things up...
Need some very urgen help...i know its simple but i think i am not too familiar with the rules of javascriting/c++ hence a poblem implimenting or chnigng the script.
Thanks
Apurva