I have the following Java code:
<script type='text/javascript'>
function Calc(){
var qnt = document.getElementById('qnt_saida').value;
var vlr = document.getElementById('vl_unt_org').value;
var tl = (qnt*1) * (vlr*1);
document.getElementById('vl_fob').value = tl;
}
</script>
It works, my problem is in the php FOR loop, the Calc () function is only called once. For this case below the same should run twice:
<?php
for($i = 0; $i < $tl_detalhe; $i++){
print "
<tr>
<td> <input class='input' id='qnt_saida' name='qnt_saida' type='text' value='".number_format($_SESSION['detalhe'][$i]->QUANTIDADE,5,",",".")."' onBlur='Calc()' /></td>
<td> <input class='input' id='vl_unt_org' name='vl_unt_org' value='".number_format($_SESSION['detalhe'][$i]->VL_UNT_ORG,7,",",".")."' readonly /> </td>
<td> <input class='input' id='vl_fob' name='vl_fob' readonly /> </td>
</tr>
";
}
?>
Could anyone help me with this question? Would I have to pass this function into the loop to be called as many times as needed?