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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onmouseout Time delay.

    Hi,

    I am new to javascript and am cobbing together a webpage for my own use.

    I have a hidden div for a submenu which is loaded by

    <a href="javascript:;" onMouseover="document.getElementById('menunews').style.visibility='visible'" >

    I then used

    onmouseout="el=this;setTimeout('el.style.visibility=\'hidden\'',1500)"

    within the DIV so that it would disapear if hovered over. However, I realised quickly if you don't hover over it, it's stuck there.

    So is there a way to modify the <a> link to have the onmouseout within it?

    Any and all help would be much appreciated.

    P.

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,503
    Thanks
    3
    Thanked 500 Times in 487 Posts
    something like perhaps
    Code:
    <script>
    var Menu,TO;
    
    function ShowMenu(id){
     Menu=document.getElementById(id);
     Menu.style.visibility='visible';
     TO=setTimeout('Menu.style.visibility=\'hidden\';',2000);
    }
    </script>
    
    <span onmouseover="ShowMenu('MyMenu');">Menu</span>
    
    <div id='MyMenu' style="visibility:hidden;width:200px;height:200px;background-color:red;"
    onmouseover="clearTimeout(TO);"
     >
    
    
    </div>
    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
    •