Tema: menú
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/07/2003, 00:43
Avatar de Bravenap
Bravenap
 
Fecha de Ingreso: noviembre-2002
Ubicación: Los Arroyos, El Escorial, Madrid
Mensajes: 2.084
Antigüedad: 21 años, 6 meses
Puntos: 4
No sé cómo será tu menú, pero hace poco que se trato otro menú en los foros. Te dejo el código porque no me acuerdo de cuál era el mensaje:

Código:
<html>
<head>
<title>Ejemplo sencillo de Men</title>
<style>
#contieneMenu{
position:RELATIVE;
top:0px;
left:0px;
}
TD.menu{
background:navy;
color:white;
font:normal 10px/10px verdana;
text-align:center;
width:100px;
padding:5px 10px 5px 10px;
}
A.enlaceMenu{
color:#ffffcc;
font:normal 10px/10px verdana;
text-decoration:none;
}
A.enlaceMenu:HOVER{
color:white;
font:normal 10px/10px verdana;
}

#contieneSubmenu{
position:relative;
top:22px;
left:-100px;
}
TD.submenu{
background:#ccccdd;
color:white;
font:normal 10px/10px verdana;
text-align:center;
width:118px;
height:20px;
border:solid 1px navy;
padding:0px 0px 0px 0px;
}

A.enlaceSubmenu{
width:100%;
height:100%;
color:#ffffcc;
font:normal 10px/20px verdana;
text-decoration:none;
}
A.enlaceSubmenu:HOVER{
color:white;
font:normal 10px/20px verdana;
background:navy;
}


</style>
<script>
var menu=new Array();
var submenu=new Array();
//OJO LO DE ABAJO DEBE QUEDAR EN UNA LINEA!!!!vvvvvvvvvvvvvvv
function nuevo(titulo,enlace,submenu1,destino1,submenu2,destino2,submenu3,destino3,submenu4,destino4,submenu5,destino5,submenu6,destino6){
//OJO LO DE ARRIBA DEBE QUEDAR EN UNA LINEA ^^^^^^^^^^^^^^
this.titulo=titulo;
this.destino=enlace;
for (c=1;c<7;c++){
eval("if(submenu"+c+"){this.opcion"+c+"=submenu"+c+";this.enlace"+c+"=destino"+c+"}\n else{this.opcion" + c + "='----'}");

}
}

codigo="<table style='position:absolute;top:0px;'><tr>"
function crearMenu(){
for(a=0;a<menu.length;a++){
if (menu[a].destino){texto="<A class='enlaceMenu' HREF='"+menu[a].destino+"'>"+menu[a].titulo+"</A>";}
else texto=menu[a].titulo;
codigo+="<td onmouseover='mostrar("+a+")' class='menu'>"+texto+"</td>";
submenu[a]="<table id='"+a+"' >\n"
for(b=1;b<7;b++){
eval("if(menu[a].opcion" + b +"!='----'){submenu[a]+='<tr><td class=\"submenu\"><A class=\"enlaceSubmenu\" HREF=\"'+menu[a].enlace"+b+"+'\">'+ menu[a].opcion"+b+"+ '</A></td></tr>';}");

}
submenu[a]+="</table>";

}
codigo+="</tr></table>";
document.getElementById("contieneMenu").innerHTML=codigo;
}
function mostrar(apartado){
document.getElementById("contieneSubmenu").innerHTML=submenu[apartado];
if(document.all){document.getElementById("contieneSubmenu").style.left=(5+(apartado*120))
}
else{document.getElementById("contieneSubmenu").style.left=apartado*50}
}
</script>
<script>
menu[0]=new nuevo("inicio","index.html");
menu[1]=new nuevo("Apartados","","Camino Soria","camino.html","Solvencia","solvencia.html","Resquemor","resquemor.html","Destitucin","destituir.html");
menu[2]=new nuevo("Contacto","contacto.html","Enviar Email","email.html","Donde estamos","localizacion.html");
menu[3]=new nuevo("KarlanKas","http://www.webareyou.com")
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body onload="crearMenu()">
<div style="position:absolute; top:-55px; left: 0; z-index:1; width: 100%;"> 
  <table cellpadding="0" cellspacing="0"><tr><td><br>
<br>
<br>
</td></tr><TR>
<td><div id="contieneMenu"></div></td></TR></table>

<div id="contieneSubmenu" onmouseleave='document.getElementById("contieneSubmenu").style.left="-1000"'></div>
</div>

</body>
</html>
Suerte.
__________________
¡¡NO A LA GUERRA!!
Si ponemos a nuestros mensajes títulos adecuados, la gente se animará más a abrirlos y resultarán más útiles en las busquedas. ¡No a los ayuuudaaa, urgenteee y similares!