I have a table with two fields: "Product Value" and "Sales Price". Another field to define a calculation for the "selling price". The function only works for the first row of the table. I would like to know how to make the calculation to be applied on all the lines in the sale price field.
function fctprecovenda(form) {
var valprod = parseFloat(form1.valprod.value);
var percentual = parseFloat(form1.percentual.value);
var precovenda = (valprod + percentual * valprod / 100);
form1.prcvenda.value = precovenda.toFixed(2);
}
<form method="post" id="form1">
<label >Definer valor %</label>
<input type="text" name="percentual" value="" onblur="fctprecovenda(form1)">
<table id ="tabvenda" nome ="tabvenda">
<tr>
<th>Valor do Produto<th>
<th>Preço de venda<th>
</tr>
<tr>
<td><input type="text" name="valprod" value="50"></td>
<td><input type="text" name="prcvenda" value=""></td>
</tr>
<tr>
<td><input type="text" name="valprod" value="100"></td>
<td><input type="text" name="prcvenda" value=""></td>
</tr>
</table>
</form>