Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/07/2009, 10:10
eddihg
 
Fecha de Ingreso: julio-2009
Mensajes: 32
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: tablas ocultas

Cita:
Iniciado por maycolalvarez Ver Mensaje
Si vas a incluir varias veces un mismo archivo html en otro, elimina los encabezados <html> y <body>, el navegador sólo procesará un onload por body, no múltiples body, lo que tienes que hacer es crear una sola función para el onload del body y en la misma aplicas el ciclo para hacer que se te oculten las tablas, luego al incluir el archivo construye el documento principal e incluye las otras páginas:

Código PHP:
/*Documento principal*/
<html>
<head>
<script>
function muestra_oculta(id){
if (document.getElementById){ //se obtiene el id
var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
}
}
function cargar(){
<?php

for($i 1$i <= 5$i ++){
        echo 
'muestra_oculta('.$i.');';
}
?>
}
</script>
</head>
<body onload="cargar();">
<?php
for($i 1$i <= 5$i ++){
        
$identificador=$i;
        include(
'mensaje.php'); //TIENE QUE SER PHP no HTML
}

?>
</body>
</html>

/*mensaje.php*/

<table id="<?php echo $identificador ?>">
<tr>
<th>
<p>Este contenido tiene que mostrarse con el link</p>
</th>
</tr>
</table>
además tienes muchas etiquetas sin cierre.
gracias muchas gracias me sirvio de mucho tu ejemplo