Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

acortez

Erro maldito em menu

Recommended Posts

Caros,

 

Fiz um menu bem simples, mas o terceiro nível não funciona de jeito nenhum.

Se alguém puder dar uma luz eu agradeço.

 

O código abaixo é um HTM com o script e os divs.

O DIV "m4" é para ser o terceiro nível. Ele está sendo chamado pelo terceiro link do segundo nível.

 

Eis o código.

 

<html>

<head>

<title>Untitled</title>

</head>

 

<script>

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

function MM_findObj(n, d) { //v3.0

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); return x;

}

 

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

 

function MM_preloadimages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadimages.arguments; for(i=0; i<a.length; i++)

if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_showHideLayers() { //v3.0

var i,p,v,obj,args=MM_showHideLayers.arguments;

for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];

if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }

obj.visibility=v; }

}

 

var Tempo=0;

function Esconde2(){

// coloca os menus invisíveis

// Autor : Elida Athayde - 15/06/2000

 

m1.style.visibility = "hidden";

m2.style.visibility = "hidden";

m3.style.visibility = "hidden";

m4.style.visibility = "hidden";

}

 

function MostraMenu(menu)

{

//mostra o menu

//Parametros:

//menu -> nome do menu a ser mostrado

//Autor: Elida Athayde - 15/06/2000

Esconde2() //ESCONDE TODOS OS MENUS ANTES DE FAZER APARECER

menu.style.visibility = "visible";

if (Tempo!=0) //ADICIONA TEMPO AO MENU

clearTimeout(Tempo) //

 

}

 

function EscondeMenu(TempoMenu)

{

Tempo = setTimeout('Esconde2()',TempoMenu)

}

 

</script>

 

<body>

 

 

<table width="90" border="0" cellspacing="1" cellpadding="3" bgcolor="#808080" style="font-family: Verdana; font-size: 11px;">

<tr>

<td bgcolor="F1F1F1" onMouseOver="MostraMenu(document.all.m1);this.style.backgroundColor='#DDDDDD';this.style.color='FF0000'" style="cursor:hand" onMouseOut="EscondeMenu(400);this.style.backgroundColor='#F1F1F1';this.style.color='000000'" onclick="window.location.href('#')">Teste</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="MostraMenu(document.all.m2);this.style.backgroundColor='#DDDDDD';this.style.color='FF0000'" style="cursor:hand" onMouseOut="EscondeMenu(400);this.style.backgroundColor='#F1F1F1';this.style.color='000000'" onclick="window.location.href('#')">Teste</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="MostraMenu(document.all.m3);this.style.backgroundColor='#DDDDDD';this.style.color='FF0000'" style="cursor:hand" onMouseOut="EscondeMenu(400);this.style.backgroundColor='#F1F1F1';this.style.color='000000'" onclick="window.location.href('#')">Teste</td>

</tr>

</table>

 

<!-- SUB MENUS -->

 

<!-- ----------- PRIMEIRO DIV ------------- -->

 

<div id="m1" Name="m1" onMouseOver="MostraMenu(document.all.m1)" onMouseOut="EscondeMenu(0)" style="position:absolute; left:101; top:15px; width:197px; height:233px; z-index:1; visibility: hidden">

<table width="90" border="0" cellspacing="1" cellpadding="3" bgcolor="#808080" style="font-family: Verdana; font-size: 11px;">

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste1</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste2</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste3</td>

</tr>

</table>

</div>

 

<!-- ----------- SEGUNDO DIV ------------- -->

 

<div id="m2" Name="m2" onMouseOver="MostraMenu(document.all.m2)" onmouseout="EscondeMenu(0)" style="position:absolute; left:101; top:35px; width:197px; height:233px; z-index:1; visibility: hidden">

<table width="90" border="0" cellspacing="1" cellpadding="3" bgcolor="#808080" style="font-family: Verdana; font-size: 11px;">

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste1</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste2</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste3</td>

</tr>

</table>

</div>

 

 

<!-- ----------- TERCEIRO DIV ------------- -->

 

<div id="m3" Name="m3" onMouseOver="MostraMenu(document.all.m3)" onMouseOut="EscondeMenu(0)" style="position:absolute; left:101; top:55px; width:197px; height:233px; z-index:1; visibility: hidden">

<table width="90" border="0" cellspacing="1" cellpadding="3" bgcolor="#808080" style="font-family: Verdana; font-size: 11px;">

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste1</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste2</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="MostraMenu(document.all.m4);this.style.backgroundColor='#DDDDDD';this.style.color='FF0000'" style="cursor:hand" onMouseOut="EscondeMenu(400);this.style.backgroundColor='#F1F1F1';this.style.color='000000'" onclick="window.location.href('#')">Teste3</td>

</tr>

</table>

</div>

 

 

<!-- ----------- QUARTO DIV ------------- -->

 

<div id="m4" Name="m4" onMouseOver="MostraMenu(document.all.m4)" onMouseOut="EscondeMenu(0)" style="position:absolute; left:192; top:95px; width:197px; height:233px; z-index:1; visibility: hidden">

<table width="90" border="0" cellspacing="1" cellpadding="3" bgcolor="#808080" style="font-family: Verdana; font-size: 11px;">

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste1</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste2</td>

</tr>

<tr>

<td bgcolor="F1F1F1" onMouseOver="this.style.backgroundColor='#DDDDDD';this.style.color='#FF0000'" style="cursor:hand" onMouseOut="this.style.backgroundColor='#F1F1F1';this.style.color='#000000'" onclick="window.location.href('#')">Teste3</td>

</tr>

</table>

</div>

 

 

</body>

</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Realmente, para casos de javascript piro, existe um forum especificoMovido de ASP para Javascript

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.