<script language="javascript">
function fncCal()
{
var tot = 0;
var sum = 0;
for(i=1;i<=5;i++)
{
tot = parseInt(eval("document.form1.txtVol1_"+i+".value")) + parseInt(eval("document.form1.txtVol2_"+i+".value"))
eval("document.form1.txtVol3_"+i+".value="+tot);
sum += tot;
document.form1.txtSum.value=sum;
}
}
</script>
Tag : PHP, MySQL, HTML/CSS, JavaScript
Date :
2016-11-03 15:21:00
By :
kyo00zero
View :
660
Reply :
1
No. 1
Guest
Code (PHP)
<script>
var input = document.form1.getElementsByTagName('input');
var loop = parseInt(input.length) - 2;
var total = 0;
for(i=0;i<loop;i++){
total += parseInt(input[i].value);
}
document.form1.result.value = total;
</script>