Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/05/2010, 16:31
Avatar de wiwi74
wiwi74
 
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 11 meses
Puntos: 10
Respuesta: Cambiar color background a DIV con checkBox

Bueno pero nada mas por hoy:

Si deseas agregar mas radios fijate en esto:

para el primer radio 1 se pone rojo 2 blanco
onclick="document.getElementById('1').style.backgr oundColor='red';
document.getElementById('2').style.backgroundColor ='white';
si habria un tercero lo ponemos blanco
document.getElementById('3').style.backgroundColor ='white';



para el segundo radio 2 se pone rojo 1 blanco
onclick="document.getElementById('2').style.backgr oundColor='red';
document.getElementById('1').style.backgroundColor ='white';
si habria un tercero lo ponemos blanco
document.getElementById('3').style.backgroundColor ='white';


En sintesis le pone el mismo numero ('aqui') que tiene la fila <tr id='num'> donde se encuantra el radio.



El codigo:




<form>
<table border="1" cellpadding="10">
<tr id="1">
<td><input type="radio"
name="equipo"
value="equipo1"
onclick="document.getElementById('1').style.backgr oundColor='red';
document.getElementById('2').style.backgroundColor ='white';
" />
</td>
<td >Contenido</td>
<td >Contenido</td>
<td >Contenido</td>
</tr>

<tr id="2">
<td><input type="radio"
name="equipo"
value="equipo2"
onclick="document.getElementById('2').style.backgr oundColor='red';
document.getElementById('1').style.backgroundColor ='white';
" />
</td>
<td >Contenido</td>
<td >Contenido</td>
<td >Contenido</td>
</tr>

</table>
</form>