Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    div disappear issue

    I've got a div hide function below for my menu, but for some reason the menu won't disappear after the set time. It merely disappears on the mouseout.
    Code:
    var disappearTimer;
    function menu_On(menu)
    {
    	document.getElementById(menu).style.visibility="visible";
    }
    function menu_Off(menu)
    {
    	disappearTimer = setTimeout(document.getElementById(menu).style.visibility='hidden', 1000);
    }
    function clear_Off()
    {
    	clearTimeout( disappearTimer );
    }
    What's the issue?

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    var disappearTimer;
    function menu_On(menu)
    {
    	document.getElementById(menu).style.visibility="visible";
    }
    function menu_Off(menu)
    {
    	disappearTimer = setTimeout(function(){ document.getElementById(menu).style.visibility='hidden'; }, 1000);
    }
    function clear_Off()
    {
    	clearTimeout( disappearTimer );
    }
    /*]]>*/
    </script></head>
    
    <body>
    <BR><BR>
    <BR><BR>
    <input id="tst" type="button" name="" value="Test" onmouseout="menu_Off('tst');"/>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • Users who have thanked vwphillips for this post:

    bftwofreak (10-04-2008)

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    New issue

    My latest problem with the same Timeout
    Code:
    var disappearTimer;
    
    function menu_On(menu)
    {
    	document.getElementById(menu).style.visibility="visible";
    }
    
    function menu_Hide()
    {
    	document.getElementById('info').style.visibility="hidden";
    	document.getElementById('tick').style.visibility="hidden";
    }
    
    function menu_Off()
    {
    	disappearTimer = setTimeout( menu_Hide() , 1000 );
    }
    
    function clear_Off(menu)
    {
    	clearTimeout( disappearTimer );
    }
    Last edited by bftwofreak; 10-08-2008 at 03:26 AM.

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    Code:
    function menu_Off()
    {
    	disappearTimer = setTimeout(function(){ menu_Hide() }, 1000 );
    }
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •