How can I get my submenus to disppear after a certain period?
<p>I want to set time for my submenus to disppear after a certain period using JavaScript. My code is:</p>

<pre><code>function buildsubmenus(){
    for (var i=0; i&lt;menuids.length; i++){
        var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")

        for (var t=0; t&lt;ultags.length; t++){
            ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"

            if (ultags[t].parentNode.parentNode.id==menuids[i]) 
                //if this is a first level submenu
                //dynamically position first level submenus to be width of main menu item
            ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px"
    else 
                //else if this is a sub level submenu (ul)
                //position menu to the right of menu item that activated it
        ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" 

            ultags[t].parentNode.onmouseover=function(){
                this.getElementsByTagName("ul")[0].style.display="block"
                if(this.getElementsByTagName("a").length  == '1'){
                    this.getElementsByTagName("ul")[0].style.display="none"   
                }
            }

function wait(){
    setTimeout('times()', 5000)
}

ultags[t].parentNode.onmouseout=function times(){
    this.getElementsByTagName("ul")[0].style.display="none"
}
}
    for (var t= ultags.length-1; t&gt;-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
    ultags[t].style.visibility="visible"
    ultags[t].style.display="none"
    }
  }
}
</code></pre>

<p>and my function that I want to display after a certain time is <code>times()</code>, but whenever I do <code>onmouse</code> it calls it directly and it doesn't wait for the time to count.</p>
