Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/08/2007, 14:57
Avatar de AlZuwaga
AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 9 meses
Puntos: 535
Re: SOLUCIONADO: 'className' es nulo o no es un objeto

Gracias derkenuke!! Me fue de muchísima ayuda tu respuesta.
Pude solucionar todos los problemas, y lo dejé funcionando en IE. Acá lo dejo para el que lo quiera usar:

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Manipular una tabla</title>
<script type="text/javascript">
function prepara_tabla(){
	var tabla = document.getElementById('mi_tabla');
	var filas = tabla.rows;
	for(i = 0; i < filas.length; i++){
		la_celda = filas[i].cells[filas[i].cells.length - 1];
		if(la_celda.nodeName.toLowerCase() == 'td'){
			filas[i].className = 'az_fila_origen';
		}
	}
	crea_copias('az_fila_origen');
}


function crea_copias(laClase){
	var tabla = document.getElementById('mi_tabla');
	var filas = tabla.rows;
	for(i = 0; i < tabla.rows.length; i++){
		if(filas[i].className == laClase){
			la_celda = filas[i].cells[filas[i].cells.length - 1];
			nuevo_row = document.createElement('tr');
				nuevo_cell = document.createElement('td');
				nuevo_cell.colSpan = 5;
				nuevo_cell.style.whiteSpace = 'normal';
					nuevo_cell_texto = document.createTextNode(la_celda.innerHTML);
				nuevo_cell.appendChild(nuevo_cell_texto);
			nuevo_row.style.display = 'none';
			nuevo_row.className = 'azNuevaFila';
			nuevo_row.appendChild(nuevo_cell);
			la_celda.innerHTML = '';
			nueva_imagen = document.createElement('img');
			nueva_imagen.setAttribute('src', 'images/flecha_abajo.gif');
			nueva_imagen.onclick = function(){muestra_oculta(this);};
			nueva_imagen.onmouseover = function(){this.style.cursor = 'pointer';};
			la_celda.appendChild(nueva_imagen);
			// comienza código de caricatos para emular un insertAfter \\
			if(filas[i].parentNode.lastChild == filas[i]){
				filas[i].parentNode.appendChild(nuevo_row);
			}
			else{
				filas[i].parentNode.insertBefore(nuevo_row, filas[i].nextSibling);
			}
			// finaliza código de caricatos para emular un insertAfter \\
		}
	}
}

function muestra_oculta(elemento){
	la_fila = elemento.parentNode.parentNode.nextSibling;
	if(la_fila.style.display == 'none'){
		la_fila.style.display = '';
		elemento.src = 'images/flecha_arriba.gif';
	}
	else{
		la_fila.style.display = 'none';
		elemento.src = 'images/flecha_abajo.gif';
	}
}

window.onload = prepara_tabla;
</script>
<style type="text/css">
<!--
#mi_tabla {
	border-collapse: collapse;
	font-family: Georgia, "Times New Roman", Times, serif;
	width: 650px;
}

#mi_tabla th {
	background: #CCCCCC;
}

#mi_tabla td, #mi_tabla th {
	border: 1px solid #666666;
	padding: 5px;
}

#mi_tabla td {
	vertical-align: top;
	white-space: nowrap;
}

.azNuevaFila{
	background: #F7F7F7;
	color: #333333;
	border-bottom: 5px solid #666666;
	font-size: 12px;
}
-->
</style>
</head>

<body>
<h1>Manipular una tabla</h1>
<table id="mi_tabla" cellspacing="1">
  <tr>
    <th scope="col">Pel&iacute;cula</th>
    <th scope="col">Director</th>
    <th scope="col">Escritores</th>
    <th scope="col">G&eacute;nero</th>
    <th scope="col">Sin&oacute;psis</th>
  </tr>
  <tr>
    <td>El extra&ntilde;o mundo de Yack </td>
    <td>Henry Selick</td>
    <td>Tim Burton, Michael McDowell</td>
    <td>Animaci&oacute;n, Familia, Fantas&iacute;a, Musical</td>
    <td>Jack Skellington (The pumpkin king) lives in halloweentown and as usual he celebrates haloween, but he's bored and finds a mysterious forest with 6 doors he opens the christmas tree one and discovers christmastown. The Haloween town residents are worried and go searching for jack until he comes home and calls a town meeting where he tells the townfolk about his new discovery and a mysterious man nicknamed &quot;Santy claus&quot;. After a long researching process he finds out what christmas really means. He gives everyone a job for his own version of christmas until sally (his number 1 admirer) tells him that it will be a HUGE disaster ! He does not listen and tells the Trick or Treat kids to kidnap Santy Claus and to not tell oogie boogie (the evil Dude !!) about his plan. When he sets of on his slay he ends up being blown up out of the sky and going back to haloween town to save sally and santy claus from oogie boogie's lair.</td>
  </tr>
  <tr>
    <td>Mars Attacks!</td>
    <td>Tim Burton</td>
    <td>Len Brown, Woody Gelman</td>
    <td>Acci&oacute;n, Comedia, Fantas&iacute;a, Sci-Fi</td>
    <td>The Martians decide to attack our planet and devastate everything. Why? Because it's fun!!! They enjoy killing people and destroy buildings; they even play bowling with the statues at Easter Isles and pose for photos in front of temples as they are blowing up. Will somebody find a way to stop them or will everyone die in the war with these short, big-brained aliens?</td>
  </tr>
  <tr>
    <td>Charly y la f&aacute;brica de chocolates </td>
    <td>Tim Burton</td>
    <td>Roald Dahl, John August</td>
    <td>Aventuras, Comedia, Familia, Fantas&iacute;a</td>
    <td>Charlie Bucket comes from a poor family, and spends most of his time dreaming about the chocolate that he loves but usually can't afford. Things change when Willy Wonka, head of the very popular Wonka Chocolate empire, announces a contest in which five gold tickets have been hidden in chocolate bars and sent throughout the country. The kids who find the tickets will be taken on a tour of Wonka's chocolate factory and get a special glimpse of the wonders within. Charlie miraculously finds a ticket, along with four other children much naughtier than him. The tour of the factory will hold more than a few surprises for this bunch.</td>
  </tr>
</table>
</body>
</html>

Cita:
En FF por lo menos lo he visto y es un script con un resultado muy bonito. A ver si lo consigues en IE y lo posteas!
Qué emoción
Es la primera vez que me dicen que algo esta bonito