Código PHP:
<html>
<head>
<title>Menú lateral con submenús</title>
<style TYPE="text/css">
A:link, A:visited { text-decoration:none;}
A:hover {text-decoration:underline; font-weight : bold;}
</style>
</head>
<?php
echo"<script>\n";
echo"var menublock=new Array()\n";
echo"var plus_i=0\n";
echo"var contador=0\n";
echo"</script>\n";
include("conexion.php");
$link=conectarse();
$result=mysql_query("select DISTINCT yearfoto from fotos ORDER BY yearfoto",$link);
while($row=mysql_fetch_array($result))
{
$aux=$row["yearfoto"];
echo"<script>\n";
echo"var a=\"$aux\"\n";
echo"menublock[contador++]='Verdana;'+\n";
echo" '2;'+\n";
echo" '#FFFFFF;'+\n";
echo" '1;'+\n";
echo" 'Verdana;'+\n";
echo" '2;'+\n";
echo" '#FFFFFF;'+\n";
echo" '0;'+\n";
echo" ''+a+'|#|;'+\n";
echo" 'Identificación|fotoimpresa.php?anofoto='+a+'&name=hovmoller&|fotos;'+\n";
echo" 'Cuantificación|fotoimpresa.php?anofoto='+a+'&name=conteo&|fotos;'+\n";
echo" 'Seguimiento Horizontal|fotoimpresa.php?anofoto='+a+'&name=evolucion&|fotos;'+\n";
echo" 'Seguimiento Vertical|fotoimpresa.php?anofoto='+a+'&name=corte&|fotos;'+\n";
echo" 'Estado medio Atmosferico(viento)|fotoimpresa.php?anofoto='+a+'&name=estadouv&|fotos;'+\n";
echo" 'Estado medio Atmosferico(humedad)|fotoimpresa.php?anofoto='+a+'&name=estadopw&|fotos;'+\n";
echo" 'Ondículas|fotoimpresa.php?anofoto='+a+'&name=viento&|fotos;'+\n";
echo" 'Simulaciones Numéricas|/dominio/frames.php|_blank;'\n";
echo"</script>\n";
}
mysql_free_result($result);
echo"<script>\n";
echo"var menusplit\n";
echo"var urlsplit\n";
echo"var ochoplit\n";
echo"var font_weight_main\n";
echo"var font_weight_sub\n";
echo"var font_weight_sub\n";
echo"var minusimg=new Image()\n";
echo"minusimg.src='minus131.gif'\n";
echo"var plusimg=new Image()\n";
echo"plusimg.src='plus131.gif'\n";
echo"var showsubmenus=new Array()\n";
echo"for (i=0;i<=menublock.length-1;i++) {\n";
echo"showsubmenus[i]=-1\n";
echo" }\n";
echo"var plusminusimg=new Array()\n";
echo"for (i=0;i<=menublock.length-1;i++){\n";
echo"plusminusimg[i]=plusimg.src\n";
echo"}\n";
echo"var showsubmenudos=new Array()\n";
echo"for (i=0;i<=menublock.length-1;i++) {\n";
echo"showsubmenudos[i]=-1\n";
echo" }\n";
echo"var plusminusimgdos=new Array()\n";
echo"for (i=0;i<=menublock.length-1;i++){\n";
echo"plusminusimgdos[i]=plusimg.src\n";
echo"}\n";
echo"function openandclose(visi){\n";
echo" showsubmenus[visi]=(-1)*showsubmenus[visi]\n";
echo" var menucontent=''\n";
echo" if (showsubmenus[visi]==1) {plusminusimg[visi]=minusimg.src}\n";
echo" if (showsubmenus[visi]==-1) {plusminusimg[visi]=plusimg.src}\n";
echo" menucontent+='<table border=0 CELLSPACING=1 CELLPADDING=1>'\n";
echo" menucontent+='<tr><td></td><td align=\"center\"><font color=\"#FFFFFF\"><strong>CONSULTAS</strong></font></td>'\n";
echo" menucontent+='<tr><td></td><td align=\"center\"><font color=\"#FFFFFF\"><strong>ANUALES</strong></font></td></tr>'\n";
echo" for (i=0;i<=menublock.length-1;i++) {\n";
echo" menusplit=menublock[i].split(';')\n";
echo" urlsplit=menusplit[8].split('|')\n";
echo" font_weight_main='<b>'\n";
echo" font_weight_sub=''\n";
echo" menucontent+='<tr><td>'\n";
echo" if (menusplit[9].length!=0) {\n";
echo" var thismainmenu=i+plus_i\n";
echo" menucontent+='<a href=\"javascript:openandclose('+i+')\">'\n";
echo" menucontent+='<img src='+plusminusimg[i]+' border=0></a></td>'\n";
echo" menucontent+='<td align=\"left\">'\n";
echo" menucontent+=font_weight_main\n";
echo" menucontent+='<a href=\"javascript:openandclose('+i+')\">'\n";
echo" menucontent+='<font color=\"'+menusplit[2]+'\" size=\"'+menusplit[1]+'\">'\n";
echo" menucontent+=urlsplit[0]\n";
echo" menucontent+='</font></a></td></tr>'\n";
echo" ochoplit=menusplit[8].split('|')\n";
echo" if (showsubmenus[i]==1) {\n";
echo" for (ii=9;ii<=menusplit.length-1;ii++) {\n";
echo" urlsplit=menusplit[ii].split('|')\n";
echo" menucontent+='<tr><td></td><td align=\"left\">'\n";
echo" menucontent+=font_weight_sub\n";
echo" ano=\"'+ochoplit[0]+'\"\n";
echo" menucontent+='<a href=\"'+urlsplit[1]+'\" target=\"'+urlsplit[2]+'\" >'\n";
echo" menucontent+='<font color=\"'+menusplit[6]+'\" size=\"'+menusplit[5]+'\">'\n";
echo" menucontent+=urlsplit[0]\n";
echo" menucontent+='</font></a></td></tr>'\n";
echo" }\n";
echo" }\n";
echo" }\n";
echo" }\n";
echo" menucontent+='</table>'\n";
echo" if (document.all) {\n";
echo" menu.innerHTML=menucontent\n";
echo" }\n";
echo" if (document.layers) {\n";
echo" document.menu.document.write(menucontent)\n";
echo" document.menu.document.close()\n";
echo" }\n";
echo"}\n";
echo"</script>\n";
echo"</head>\n";
echo"</b></font></p>\n";
echo"<body onLoad='openandclose(1000)' bgcolor='#056084'>\n";
echo"<div id='menu'></div>\n";
echo"</body>\n";
?>
</html>
</head>