Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/05/2010, 17:07
Bier
 
Fecha de Ingreso: enero-2002
Mensajes: 1.174
Antigüedad: 22 años, 3 meses
Puntos: 21
Respuesta: Cambiar color background a DIV con checkBox

Gracias.
  1. He adaptado un poco el código y trabaja perfecto para mi requerimiento.
  2. En mi aplicación realmente tengo 100 filas y 6 botones radio por fila, lo que hace un total de 600 opciones radio.
  3. Mi aplicación es PHP y puedo asignar el código sin problema

A continuación muestro el código que estoy empleando.

Pregunta: ¿Podría incluirse una función y evitar saturar de código el HTML?

Gracias anticipadas.


Código HTML:
Ver original
  1. <table border="1" cellpadding="10">
  2.  
  3. <tr id="1">
  4. <td>
  5. <input  type="radio" name="equipo1" value="1" onclick="document.getElementById('1').style.backgroundColor='blue';" />
  6. </td>
  7. <td>
  8. <input type="radio" name="equipo1" value="2" onclick="document.getElementById('1').style.backgroundColor='red';" />
  9. </td>
  10. <td ><input type="radio" name="equipo1" value="3" onclick="document.getElementById('1').style.backgroundColor='yellow';" />
  11. </td>
  12. <td >Contenido</td>
  13. </tr>
  14.  
  15. <tr id="2">
  16. <td>
  17. <input  type="radio" name="equipo2" value="1" onclick="document.getElementById('2').style.backgroundColor='blue';" />
  18. </td>
  19. <td>
  20. <input type="radio" name="equipo2" value="2" onclick="document.getElementById('2').style.backgroundColor='red';" />
  21. </td>
  22. <td ><input type="radio" name="equipo2" value="3" onclick="document.getElementById('2').style.backgroundColor='yellow';" />
  23. </td>
  24. <td >Contenido</td>
  25. </tr>
  26.  
  27. <tr id="3">
  28. <td>
  29. <input  type="radio" name="equipo3" value="1" onclick="document.getElementById('3').style.backgroundColor='blue';" />
  30. </td>
  31. <td>
  32. <input type="radio" name="equipo3" value="2" onclick="document.getElementById('3').style.backgroundColor='red';" />
  33. </td>
  34. <td ><input type="radio" name="equipo3" value="3" onclick="document.getElementById('3').style.backgroundColor='yellow';" />
  35. </td>
  36. <td >Contenido</td>
  37. </tr>
  38.  
  39. </form>