Menu desplegable

He encontrado un menu desplegable que va muy bien, el que le interese ya sabe, a mi me ha gustado se pone entre <head> </head>, en mi pagina lo he colocado y se ve bien.


<script language="javascript">

var interval = 0;

function Menu(lpos, rpos, value, ref, width, height, visibility)
{
this.id = lpos + rpos;
this.lpos = lpos;
this.rpos = rpos;
this.value = value
this.ref = ref;
this.width = width;
this.height = height;
this.left = 0;
this.top = 0;
this.visibility = visibility;
this.level = lpos.length;
}

aMenu = new Array();
//constructor
//menu = new Menu('key1', 'key2', 'value', 'target', 'length', 'height', 'visibility: 1=visible; 0=hidden')
//Parent menu must be declared visible - 1

//menu - level 0
aMenu[0] = new Menu('0', '0', 'Menú principal', 'plantilla 1.html', 130, 20, 1);
aMenu[1] = new Menu('0', '1', 'Poesías >>', 'plantilla 2.html', 130, 20, 1);
aMenu[2] = new Menu('0', '2', 'Biografía', 'plantilla 3.html', 130, 20, 1);
//submenu1 - level 1
aMenu[3] = new Menu('01', '0', 'Enseñanzas', 'plantilla 4.html', 130, 20, 0);
aMenu[4] = new Menu('01', '1', 'Sitges >>', 'sitges 1.html', 130, 20, 0);
//submenu2 - level 2
aMenu[5] = new Menu('011', '0', 'Libros descarga', 'plantilla 7.html', 130, 20, 0);
aMenu[6] = new Menu('011', '1', 'La voz interna >>', 'pensamientos2.html', 130, 20, 0);
aMenu[7] = new Menu('011', '2', 'Naturaleza', 'plantilla 5.html', 130, 20, 0);
//submenu3 - level 3
aMenu[8] = new Menu('0111', '0', 'Animales', 'plantilla 6.html', 130, 20, 0);
aMenu[9] = new Menu('0111', '1', 'Poesias Da >>', 'poesias 2.html', 130, 20, 0);
//submenu4 - level 4
aMenu[10] = new Menu('01111', '0', 'Descarga musica Clara', 'plantilla 8.html', 130, 20, 0);
aMenu[11] = new Menu('01111', '1', 'Poesias El poeta', 'poesias 3.html', 130, 20, 0);
aMenu[12] = new Menu('01111', '2', 'Poesias Busca la luz', 'poesias 4.html', 130, 20, 0);

function hideAll(Object)
{
for (var i = 1; i < aMenu.length; i++)
{
if (aMenu.lpos != '0')
document.getElementById(aMenu.id).style.visibility = 'hidden';
}
}

function showMenus(Object)
{
for (var i = 0; i < aMenu.length; i++)
{
if (aMenu.id == Object.id) // find menu
{
for (var j = i; j < aMenu.length; j ++)
{
if (aMenu.lpos == aMenu.id) // find submenu
{
document.getElementById(aMenu.id).style.visibility = 'visible';
}
else // hide rest
{
if ((aMenu.lpos != '0') && (aMenu.level >= aMenu.level + 1))
{
document.getElementById(aMenu.id).style.visibility = 'hidden';
}
}
}
}
}
}

function finterval()
{
interval = setInterval('hideAll(Object)', 500);
}

function shadowMenu(Object)
{
for (var i = 0; i < aMenu.length; i++)
{
if (aMenu.id == Object.id)
document.getElementById(aMenu.id).style.background = '#00CCFF';
}
clearInterval(interval);
}

function unshadowMenu(Object)
{
for (var i = 0; i < aMenu.length; i++)
{
if (aMenu.id == Object.id)
document.getElementById(aMenu.id).style.background = '#CCCCCC';
}
finterval();
}

function writeMenu(Menu)
{
this.background_color = 'background-color: #CCCCCC;';
this.margin_bottom = 'margin-bottom: 1px;';
this.border_width = 'border-width: thin;';
this.border_style = 'border-style: groove;';
this.color = 'color: #0000FF;';
this.vwidth = 'width:' + Menu.width.toString() + 'px;';
this.vheight = 'height:' + Menu.height.toString() + 'px;';
this.font_family = 'font-family:Verdana, Arial, Helvetica, sans-serif;';
this.font_size = 'font-size:11px;';
this.font_weight = 'font-weight:bold;';
this.text_decoration = 'text-decoration:none;';
this.text_align = 'text-align:left;';
this.text_indent = 'text-indent: 10px;';
this.text_shadow = 'text-shadow:Maroon;';
this.vleft = 'left: ' + Menu.left.toString() + 'px;';
this.vtop = 'top: ' + Menu.top.toString() + 'px;';

if (Menu.visibility == 0)
this.vvisibility = 'visibility: hidden;';
else
this.vvisibility = 'visibility: visible;';

this.strMenu = '<A ' + 'HREF="' + Menu.ref + '"' + 'TARGET="_self"'
+ 'ID="' + Menu.id + '"' + 'VALUE="' + Menu.value + '"'
+ 'onClick="hideAll(this)"'
+ 'onMouseOver="showMenus(this); shadowMenu(this)"'
+ 'onMouseLeave="unshadowMenu(this)"'
+ 'style="' + this.background_color + this.margin_bottom + this.border_width
+ this.border_style + this.color + this.vwidth
+ this.vheight + this.font_family + this.font_size
+ this.font_weight + this.text_decoration + this.text_align + this.text_indent
+ this.vvisibility + this.vleft + this.vtop
+ 'position: absolute;' + this.text_shadow + '">'
+ Menu.value + '</A>';

document.write(this.strMenu);
}

function genMenu(aMenu)
{
aMenu[0].left = 15; // left position
aMenu[0].top = 100; // top position

writeMenu(aMenu[0]);

for (var i = 1; i < aMenu.length; i++)
{
if (aMenu.lpos == aMenu[i - 1].lpos) // same menu
{
aMenu.left = aMenu[i - 1].left;
aMenu.top = aMenu[i - 1].top + aMenu[i - 1].height;
writeMenu(aMenu);
}
for (var k = 0; k < i; k++)
{
if ((aMenu.lpos == (aMenu.lpos + aMenu.rpos)) && (aMenu.lpos != aMenu[i - 1].lpos)) // find submenu
{
aMenu.left = aMenu.left + aMenu.width;
aMenu.top = aMenu.top;
writeMenu(aMenu);
}
}
}
}

genMenu(aMenu);
</script>
voy a probarlo creo que deberia de ir en la secion de script va bien muy util gracias
no creo que pase na cuando lo vea un moderador si le parece a el que lo cambie
Después de poner el codigo entre head y /head como pones el menu en el lugar que lo quieres en la pagina?
no creo que se pueda cambiar pero tampoco queda tan mal donde sale

otra cosa es un pregunta para ti pedrocuenca

¿a ti te gusta CLARA EISMAN PATON?
ha bueno entoces no prolem por que me estaba preguntado si le gusta CLARA EISMAN PATON que hace que esta poniendo descargas de sus libros eso se supone que seria un tipo de pirateria pero bueno tratandose de tu mujer jejejeje

otra cosa el otro dia me mandastes un mensaje para que añadiera tu web en mi directorio pero resulta que he cambiado de servidor a este nuevo

:arrow: http://directorios-web.freetzi.com/

Gracias por poner un enlace hacia mi antigua web si la pudieras actualizar seria perfecto jejej
Power ahora mismo lo hago ya lo había apuntado, tu tranquilo que voy a poner a todos pues aunque llevo poco en el foro os tengo bastante aprecio pues veo inquietud, compañerismo y buenos modales.
Mi problema es que no tengo tiempo, pero lo sacaré de donde sea.

Por otro lado piensa que esas descargas que dices son pocas por las que llegaran ser, la vida es dura y hay que tomar decisiones.

Poco a poco iremos avanzando hasta la cumbre

Saludos de Pedro
Bueno me lo he estado mirando un poquito, y haciendo pruebas, no muchas pero bueno la kit de la cuestión estaría aquí.

function writeMenu(Menu)
{
this.background_color = 'background-color: #CCCCCC;';
this.margin_bottom = 'margin-bottom: 1px;';
this.border_width = 'border-width: thin;';
this.border_style = 'border-style: groove;';
this.color = 'color: #0000FF;';
this.vwidth = 'width:' + Menu.width.toString() + 'px;'; Aquí estaria el ancho de las celdas cambiando px y debajo el ancho]
this.vheight = 'height:' + Menu.height.toString() + 'px;';
this.font_family = 'font-family:Verdana, Arial, Helvetica, sans-serif;';
this.font_size = 'font-size:11px;';
this.font_weight = 'font-weight:bold;';
this.text_decoration = 'text-decoration:none;';
this.text_align = 'text-align:left;';
this.text_indent = 'text-indent: 10px;';
this.text_shadow = 'text-shadow:Maroon;';
this.vleft = 'left: ' + Menu.left.toString() + 'px;';
this.vtop = 'top: ' + Menu.top.toString() + 'px;'; Podemos poner aquí bottom, y no sale el menú abajo

Bueno Tania es cuestión de ir haciendo pruebas en todas estas órdenes

Hasta la próxima
Gracias pedrocuenca, me lo copie por si alguna vez me hacia falta, como no es imediato aun no lo he trasteado. pero si encuentro como ttambien lo pondre para que lo sepamos todos
Tania y Power he encontrado esto del menu desplegable


function genMenu(aMenu)
{
aMenu[0].left = 30; // left position
aMenu[0].top = 140; // top position

cambiando esas medidas el menu se va desplazando

Saludos


P.D. Que te iba a decir Power, de los directorios que estoy registrado el tuyo es el que tengo más visitas, gracias