SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I change this from onClick to hover?

    HTML Code:
    <style type="text/css">
    .text{display: none;width:300px;border: solid 1px lightblue;}
    #text0{display: block;}
    </style>
    
    <script type="text/javascript">
    var currLayerId = "text0";
    function togLayer(id)
    {
    if(currLayerId) setDisplay(currLayerId, "none");
    if(id)setDisplay(id, "block");
    currLayerId = id;
    }
    
    function setDisplay(id,value)
    {
    var elm = document.getElementById(id);
    elm.style.display = value;
    }
    </script>
    
    <a href="#" onclick="togLayer('text0');return false;">text0</a>
    <a href="#" onclick="togLayer('text1');return false;">text1</a>
    <a href="#" onclick="togLayer('text2');return false;">text2</a>
    <a href="#" onclick="togLayer(null)">Show none</a>
    
    <div id="text0" class="text">Content of text0</div>
    <div id="text1" class="text">Content of text1</div>
    <div id="text2" class="text">Content of text2</div>

  2. #2
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the word "click" to "mouseover".

  3. #3
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that was silly, thank you!


Bookmarks

Posting Permissions

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