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>
<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>