<form method="POST" action="Capt_Calif.php" onsubmit="return valida(parcial)">
<!-- arreglos usando class para ser llamados por js, p1=calif de parcial1 -->
<td><input type="text" name="parcialP1[]" class="p1" size="3" value="<?php echo $alumno[2]; ?>" ></td>
<td><input type="text" name="parcialP1[]" class="ip1" size="3" value="<?php echo $alumno[3]; ?>" ></td>
<td><input type="text" name="parcialP2[]" class="p2" size="3" value="<?php echo $alumno[4]; ?>" ></td>
<td><input type="text" name="parcialP2[]" class="ip2" size="3" value="<?php echo $alumno[5]; ?>" ></td>
<td><input type="text" name="parcialP3[]" class="p3" size="3" value="<?php echo $alumno[8]; ?>" ></td>
<td><input type="text" name="parcialP3[]" class="ip3" size="3" value="<?php echo $alumno[9]; ?>" ></td>
<td><input type="hidden" name="idgpo[]" value="<?php echo $alumno[10]; ?>" readonly></td>
<td><input type="hidden" name="idalumno[]" value="<?php echo $alumno[7]; ?>" readonly></td>
<td><input type="text" name="final[]" class="final" size="3" value="<?php echo $alumno[11]; ?>" readonly ></td>
<td><input type="text" name="porcent[]" class="final" size="3" value="<?php echo $alumno[12]; ?>" readonly ></td>
<td><input type="text" name="asistotales[]" class="inatot" size="3" value="" ></td>
</form>
<script type="text/javascript">
function valida(parcial) {
var i,
inputs,
inputsTotal,
inputsIndex;
for (i=0; i < parcial; i++) {
inputs = document.getElementsByClassName(parcial[i]);
var n = inputs.length;
inputsIndex = 0;
inputsTotal = inputs.length;
for(inputsIndex; inputsIndex < inputsTotal; inputsIndex++) {
p1 = inputs[i];
p2 = inputs[i];
p3 = inputs[i];
//////////////////////////////////////// PARA ARREGLO PARCIAL2
if (p1 = 4 || p1 = 3) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p1 = 2 || p1 = 1) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p1 > 10) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
//////////////////////////////////////// PARA ARREGLO PARCIAL1
if (p2 = 4 || p2 = 3) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p2 = 2 || p2 = 1) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p2 > 10) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
//////////////////////////////////////// PARA ARREGLO PARCIAL3
if (p3 = 4 || p3 = 3) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p3 = 2 || p3 = 1) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
if (p3 > 10) {
alert('Escala Incorrecta: Ingrese Evaluación entre: 5 - 10');
return false;
}
}//segundo for
}//primer for
}
</script>
<script type = "text/javascript" >
window.onload = function() { //este metodo esta, mal, algo falta
parcial(['p1', 'p2', 'p3']);
}
</script>