SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    mouse on displayed, mouse out non-displayed

    Code:
    <a href=''>display</a>
    
    <table id='onOut style='display: none'>
    
      <tr>
        <td>test</td>
      </tr>
    
    </table>
    When the page is loaded, the table 'onOut' will be not shown.


    I like to make it shown when mouse is on the link 'display and not shown when the mouse is out of the link 'display.'

    Can I do it with your help?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi joon,

    Here's one way of doing it:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Display Toggle</title>
    <style type='text/css'>
    #tgt1 {
      display: none;
      border: 1px solid #000;
    }
    </style>
    <script type='text/javascript'>
    window.onload = function()
    {
      displayToggle('trg1', 'tgt1');
    }
    function displayToggle(triggerId, targetId)
    {
      var t = document.getElementById(triggerId);
      t.onmouseover = function() {
        document.getElementById(targetId).style.display = 'block';
      };
      t.onmouseout = function() {
        document.getElementById(targetId).style.display = 'none';
      };
    }
    </script>
    </head>
    <body>
    
    <p><a href='' id='trg1'>display</a></p>
    <table id='tgt1'>
    <tr><td>test</td></tr>
    </table>
    
    </body>
    </html>

  3. #3
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you. it works fine.

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a comment:

    That'd be kind of annoying if the user wanted to select some text in the table.

  5. #5
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Those darn users - always wanting access to everything!


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
  •