Estuve haciendo un menu desplegable y anda de 10, pero queireo
que si se apretan en otra parte se cierra enves de volverlo a apretar.
Este es el código:
Código:
Gracias<style> .menu_b_st { list-style-type: none; margin:0; text-decoration: none; float: left; font-size: 14px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #999999; border-bottom-color: #999999; border-left-color: #999999; } .submenu_b_st { margin:-8px; list-style-type: none; display: none; position:absolute; background-color: #FFFFFF; color: #000000; border-top-width: 1px; border-right-width: 2px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #999999; border-right-color: #000000; border-bottom-color: #666666; border-left-color: #CCCCCC; height: auto; width: 100px; text-align: left; padding: 0px; cursor: default; float: left; font-size: 14px; } .submenu_b_st_ac{ color:#000000; text-decoration: none; background-color: #C6D9FF; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } .submenu_b_st_nod{ color:#000000; text-decoration: none; background-color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } </style> <script> function $(id){ return document.getElementById(id); } function showlayer(layer,t){ if(!t) t=false; if($(layer).style.display=="none" || $(layer).style.display==""){ if(!t) $(layer).style.display="block"; } else { $(layer).style.display="none"; } } function select_action(selec,p){ $('selected_t').innerHTML=selec; $('select').value=p; } function selec_st_t(e,t){ if(t){ e.className="submenu_b_st_ac"; }else{ e.className="submenu_b_st_nod"; } } </script> <ul class="menu_b_st"> <li> <samp onClick="showlayer('sub_menu');return false;" id="selected_t" style=" cursor:pointer;font-family:Arial, Helvetica, sans-serif;">Nuevo ▼ </samp> <ul onClick="showlayer('sub_menu');" class="submenu_b_st" id="sub_menu"> <li onmousemove="selec_st_t(this,true);" onmouseout="selec_st_t(this,false);" onClick="select_action('Nuevo ▼','nuv');return false;">Nuevo</li> <li onmousemove="selec_st_t(this,true);" onmouseout="selec_st_t(this,false);" onClick="select_action('Borrar ▼','bor');return false;">Borrar</li> <li onmousemove="selec_st_t(this,true);" onmouseout="selec_st_t(this,false);" onClick="select_action('Editar ▼','edt');return false;">Editar</li> </ul> </li> </ul><input name="select" id="select" type="hidden" value="nuv" />
Salu2