Código PHP:
<script language="javascript">
function Toggle(tabla) {
var img = document.getElementById("img_" + tabla);
tabla = document.getElementById(tabla);
if (tabla.style.display == "none") {
tabla.style.display = "block";
img.src = "images/z1.gif";
} else {
tabla.style.display = "none";
img.src = "images/z2.gif";
}
}
</script>
Código HTML:
<table width="414" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Titulo de la Tabla</td> <td><a href="javascript:void(0);" onClick="Toggle('mi_tabla1')"><img id="img_mi_tabla1" src="images/z2.gif" border="0"></a></td> </tr> </table> <table width="414" border="0" cellspacing="0" cellpadding="0" id="mi_tabla1" style="display:none;"> <tr> <td>gfgfgfgfgf</td> </tr> </table> <table width="414" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Titulo de la Tabla</td> <td><a href="javascript:void(0);" onClick="Toggle('mi_tabla2')"><img id="img_mi_tabla2" src="images/z2.gif" border="0"></a></td> </tr> </table> <table width="414" border="0" cellspacing="0" cellpadding="0" id="mi_tabla2" style="display:none;"> <tr> <td>qwerty qwerty qwerty qwerty</td> </tr> </table>