Ver Mensaje Individual
  #8 (permalink)  
Antiguo 23/01/2008, 09:47
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años, 11 meses
Puntos: 1284
Re: Cambiar el color de la fila al selecionar el radio button

Hola:

La versión guardando la variable (solo probado en explorer):

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/DTD/loose.dtd">
<html>
<head>
<title>
	http://www.caricatos.net/probador
</title>
<script>
function ini() {
	tab=document.getElementById('tabla');
	for (i=0; ele=tab.getElementsByTagName('TR')[i]; i++) {	
		ele.onmouseover = function() {iluminar(this,true)};
		ele.onmouseout = function() {iluminar(this,false)};
		ele.cells[0].onclick = function() {marcar(this)};
	}
}

function iluminar(obj,valor) {
estado = obj.getElementsByTagName("TD")[0].firstChild.checked;
if (!estado)
	obj.style.backgroundColor = (valor) ? 'blue' : 'white';
}

var marca = null;
function marcar(obj) {
	if (marca != null && marca != obj)	marca.parentNode.style.backgroundColor = "white";
	marca = obj;
}

window.onload = ini;
</script>
</head>
<body >
<form id="formu">
<table id="tabla" border> 
<tr>
 <td><input type="radio" name="actualizar" value="r1">
 <td>Nombre</td>
 <td>apellido</td>
 <td>ID</td>
</tr> 
<tr>
 <td><input type="radio" name="actualizar" value="r3">
 <td>Anacleto</td>
 <td>Roncesvalles</td>
 <td>1</td>
</tr> 
<tr>
 <td><input type="radio" name="actualizar" value="r3">
 <td>Froilán</td>
 <td>Del Cajón</td>
 <td>2</td>
</tr> 
</table>
</form>
</body>
</html>
Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo

Última edición por caricatos; 24/01/2008 a las 04:18 Razón: Arreglar la forma de marcar para responder el último post