I have a form like this:
<form name="calc" action="" id="calc">
<?php for($i=0; $i<15; $i++) { ?>
<input type="text" name="txt1[$i]" onkeyup="calcNumber()"/>
<input type="text" name="txt2[$i]" onkeyup="calcNumber()"/>
<input type="text" name="txt3[$i]" onkeyup="calcNumber()"/>
<span id="tot[$i]"></span>
<?php } ?>
</form>
And this is javascript code:
<script type="text/javascript">
function calcNumber() {
for(var j=0; j<15; j++) {
var totNumber[j] = document.calc.txt1[j].value + document.calc.txt2[j].value + document.calc.txt3[j].value;
document.getElementById('tot[j]').innerHTML = totNumber[j];
}
}
</script>
No error.. But no result either. Please let me know what I have done wrong. Thanks.
id
is not aname
– mkoryak Dec 28 '12 at 3:17