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

Thread: onmouseout

  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onmouseout

    i have this command

    <div id="offerings" onmouseover="switchMenu('ouroffer')">

    this opens up a div tag and shows a message.

    the i have another
    <div id="about" onmouseover="switchMenu('oboutus')">

    wich does the same,
    and another and so on...

    but I want it so that if you click one and it opens then you click the next on it closes any of the others that are open...

    any one help?

  • #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 HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    
    var Last='d1';
    
    function SwapDiv(id){
     document.getElementById(Last).style.height='0px';
     document.getElementById(id).style.height='100px';
     Last=id;
    }
    
    //-->
    </script></head>
    
    <body>
    <input type="button" value="D1" onclick="SwapDiv('d1');" >
    <input type="button" value="D2" onclick="SwapDiv('d2');" >
    <input type="button" value="D3" onclick="SwapDiv('d3');" >
    <div id="d1" style="position:relative;overflow:hidden;width:200px;height:100px;background-Color:red;" ></div>
    <div id="d2" style="position:relative;overflow:hidden;width:200px;height:0px;background-Color:green;" ></div>
    <div id="d3" style="position:relative;overflow:hidden;width:200px;height:0px;background-Color:blue;" ></div>
    </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/


  •  

    Posting Permissions

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