Código HTML:
<script> function promedio() { var n1 = parseFloat(document.form1.p1.value); var n2 =parseFloat(document.form1.p2.value); var n3 = parseFloat(document.form1.p3.value); document.form1.prom.value=((n1+n2+n3)/3).toFixed(2); document.getElementById(prom+'[4]').value } </script>
Y un formulario asi
<form action="<?php echo $editFormAction; ?>" method="post" id="form1" name="form1">
<table border="0" class="normal">
<thead>
<tr>
<td></td>
<td>MATRÍCULA</td>
.
.
.
Código PHP:
<?php do { ?>
<tbody>
<tr>
.
.
.
<td><input type="text" name="p1[]" id="p1[]" value="<?php echo $row_calificarm['parcial1']; ?>" onChange="promedio()" /> </td>
<td><input type="text" name="p2[]" id="p2[]" value="<?php echo $row_calificarm['parcial2']; ?>" size="3" onchange="promedio()"/> </td>
<td><input type="text" name="p3[]" id="p3[]" value="<?php echo $row_calificarm['parcial3']; ?>" size="3" onchange ="promedio()"/></td>
<td> <input type="text" name="prom[]" id="prom" value=" <?php $Promedio=($row_calificarm['parcial1']+$row_calificarm['parcial2']+ $row_calificarm['parcial3'])/3; echo number_format ($Promedio,2); ?> "size="3" style="border: none;background:#e6e6e6" /></td>