Ver Mensaje Individual
  #10 (permalink)  
Antiguo 29/11/2015, 09:24
josegaitan123
 
Fecha de Ingreso: agosto-2014
Ubicación: barranquilla
Mensajes: 93
Antigüedad: 9 años, 10 meses
Puntos: 0
Respuesta: calcular notas definitivas provenientes de una consulta en tiempo real

Gracias amigo ya lo resolvi su ayuda me dio una buena base, aqui coloco el codigo para alguien que tenga el mismo problema

funcion javascript
Código HTML:
Ver original
  1. <script language="javascript">
  2. function calcular(x){
  3.    n1 = document.getElementById("a"+x).value;
  4.    n2 = document.getElementById("b"+x).value;
  5.    n3= document.getElementById("c"+x).value;
  6.    r1= (parseFloat(n1)*0.30)+(parseFloat(n2)*0.30)+(parseFloat(n3)*0.40);
  7.    document.getElementById("def"+x).value = r1.toFixed(1);  
  8.  
  9. }
  10.  </script>
Codigo PHP
Código PHP:
Ver original
  1. while($fila=mysql_fetch_array($sqlest)){
  2.                
  3.                  ?>
  4.                  <td><?php echo $n; ?></td>
  5.                  <td><?php echo '<strong>'.$fila['apellidos']. '   ' .$fila['nombres'].'</strong>'; ?></td>
  6.                  <td> <input type="number" name="inas" size="1" maxlength="2" style="width:50px"  step="1" max="8" min="1" value="<?php echo $fila['inasistencias'] ?>"></td>
  7.                  <td> <input type="number" name="con" id="a<?php echo $n ?>"            style="width:50px"   max="5" step="0.1" min="1" autofocus value="<?php echo $fila['conocimiento'] ?>" onChange="calcular(<?php echo $n ?>);"></td>
  8.                  <td> <input type="number" name="des" id="b<?php echo $n ?>"            style="width:50px"    max="5" min="1" step="0.1" value="<?php echo $fila['desempeno'] ?>" onChange="calcular(<?php echo $n ?>);" ></td>
  9.                  <td> <input type="number" name="pro" id="c<?php echo $n ?>"             style="width:50px"     max="5" min="1" step="0.1" value="<?php echo $fila['producto'] ?>" onChange="calcular(<?php echo $n ?>);"></td>
  10.                  <td> <input type="text"  name="def" id="def<?php echo $n ?>"           style="width:50px" step="0.1"   max="5" min="1" value="<?php echo $fila['definitiva'] ?>" readonly ></td>
  11.                  <td> </td>
  12.                  <tr></tr>
  13.                <?php
  14.                 $n++;
  15.              }

Si alguien de los colaboradores me responde si es una buena solucion