então, não sou muito bom em javascript, comecei faz pouco tempo, então perdoem erros grosseiros!
o que eu quero fazer é um menu drop down, só que na horizontal =/
so far... é isso que eu consegui, ele abre, e fecha em 4 seg... o problema é que era pra ele fechar em 4 seg se o mouse nao estiver em cima do botão, nem do submenu!
agradeço desde já!
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Nova pagina 1</title> <script type="text/javascript"> var camada; var timer; function fecha(){ if(camada){ camada.style.visibility = "hidden"; } else { alert("erro"); } } function paraTempo(){ if(timer) clearTimeout(timer); } function iniciaTempo(){ timer = setTimeout("fecha()",4000); } function IEHoverPseudo() { var navItems = document.getElementById("tabela").getElementsByTagName("table") for (var i=0; i<navItems.length; i++) { navItems[i].onmouseover=function() { var camadas = this.getElementsByTagName("div"); for(var t=0; t<camadas.length; t++){ if((camada) && (camada != camadas[t])) fecha(); camada = camadas[t]; camadas[t].style.visibility = "visible"; } } navItems[i].onmouseout=function(){ var camadasB = this.getElementsByTagName("div"); for(var b=0; b<camadasB.length; b++){ iniciaTempo(); } } var camadasG = navItems[i].getElementsByTagName("div"); for(var g=0; g<camadasG.length; g++){ camadasG[g].onmouseover=paraTempo; camadasG[g].onmouseout=iniciaTempo; } } } window.onload = IEHoverPseudo; document.onclick = fecha; </script> <link rel="stylesheet" type="text/css" href="../stylesheet.css"> </head> <body> <table id="tabela" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100"> <!-- comeco menu --> <table border="0" cellpadding="0"> <tr> <td class="topo" width="100" align="center">teste1</td> </tr> <tr> <td> <div style="background:#000000; visibility:hidden; border-style:solid; border-width:1px; position: absolute; width: 95px; height: 100px; z-index: 1" id="div1"> </div> </td> </tr> </table> <!-- final menu --> </td> <td width="100"> <!-- comeco menu --> <table border="0" cellpadding="0"> <tr> <td class="topo" width="100" align="center">teste2</td> </tr> <tr> <td> <div style="background:#000000; visibility:hidden; border-style:solid; border-width:1px; position: absolute; width: 95px; height: 100px; z-index: 1" id="div2"> </div> </td> </tr> </table> <!-- final menu --> </td> <td width="100"> <!-- comeco menu --> <table border="0" cellpadding="0"> <tr> <td class="topo" width="100" align="center">teste3</td> </tr> <tr> <td> <div style="background:#000000; visibility:hidden; border-style:solid; border-width:1px; position: absolute; width: 95; height: 100px; z-index: 1" id="div3"> </div> </td> </tr> </table> <!-- final menu --> </td> <td width="100"> </td> <td width="100"> </td> <td width="100"> </td> <td width="100"> </td> </tr> </table> </body> </html>
Edição feita por: gabriel_gm, 09/02/2007, 16:43.