Ver Mensaje Individual
  #10 (permalink)  
Antiguo 26/11/2010, 15:42
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Comprobar un test con javascript

a esto es a lo que me refería, hecho de una manera rápida. ahora solo es cuestión de comprobar cual de las dos opciones consume menos recursos
Cita:
<html>
<head>
<script>
var corr = ['b', 'c'];
function fnc() {
radio_checked = -1;
for(var j = 0, rad = document.getElementsByTagName('input'); j < rad.length; j++){
if(rad[j].checked) {
radio_checked++;
if (rad[j].value == corr[radio_checked]) {
document.getElementById('c_'+radio_checked).style. backgroundColor='#9BFFA0';
} else {
document.getElementById('c_'+radio_checked).style. backgroundColor='#FF8C8C';
}
}
}
}
</script>

</head>
<body>
<table>
<tr id="c_0">
<td>
<input type="radio" value="a" name="p1" />a
<input type="radio" value="b" name="p1" />b
<input type="radio" value="c" name="p1" />c
</td></tr>
<tr id="c_1">
<td>
<input type="radio" value="a" name="p2" />a
<input type="radio" value="b" name="p2" />b
<input type="radio" value="c" name="p2" />c
</td>
</tr>
<tr>
<td>
<input type="button" onclick="fnc()" value="comprobar" />
</td>
</tr>
</table>
</body>
</html>