reallysick Posted February 27, 2006 Share Posted February 27, 2006 Hi,I have a menu with a submenu that I want to hide after 5 seconds.The submenu is a string that I hide and show on mouseOver and mouseOut.In mouseOver: var submenustring=""; for(i=0; i<AbsoluteArray[id-1].length; i++) { var x=document.getElementById('submenu').rows[0].cells; x[0].style.padding="0px 0px 0px "+px+"px"; submenustring = submenustring + AbsoluteArray[id-1][i]; if(i<AbsoluteArray[id-1].length-1) { submenustring = submenustring + " | "; } } x[0].innerHTML= submenustring; document.getElementById("submenu").style.visibility = "visible"; count(); In my count() function, I call the setTimeOut javascript function to hide my submenu after 5 seconds function count(){ var t = 0; t=setTimeout('document.getElementById("submenu").style.visibility = "hidden"',5000); clearTimeout(t);} The problem is that the "timer" doesn't start at 0 on eachmouse over so the submenu disapears before the 5 seconds is completed. I want to have a 5 seconds submenu on each mouse overThanks ! Link to comment Share on other sites More sharing options...
reallysick Posted February 27, 2006 Author Share Posted February 27, 2006 sorry, the count function looks like this (without the clear timeout) function count(){ var t = 0; t=setTimeout('document.getElementById("submenu").style.visibility = "hidden"',5000);} need help Link to comment Share on other sites More sharing options...
sbrownii Posted February 27, 2006 Share Posted February 27, 2006 Have you tried making t a global variable so you can clear the timeout before setting it again?You might want to go ahead and have a function called "hideSub" or something and have it called on mouseout and when the timer goes off...Also... please don't use tables for layout!...It is just too easy do menus without tables! Link to comment Share on other sites More sharing options...
reallysick Posted February 27, 2006 Author Share Posted February 27, 2006 thank you ill tryim working on asp.net 2.0 and I know know there are templates for menus but no one fits with what I wantI want an horizontal sub-menu like thisMENU 1 MENU 2 MENU3 MENU4 submenu1 submenu1 submenu1and the only way I found was to use a table ans jsthanks again Link to comment Share on other sites More sharing options...
sbrownii Posted February 27, 2006 Share Posted February 27, 2006 as far as horizontal menus go, take a look at the following pages if you get time and see if any of them are what you are looking forhttp://www.alistapart.com/articles/dropdowns (working example -> http://www.htmldog.com/articles/suckerfish/example/ )http://www.alistapart.com/articles/hybrid (working example -> http://www.alistapart.com/d/hybrid/hybrid-4.html ) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now