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 5 of 5

Thread: Hiding tables

  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Hiding tables

    Is it possible to hide and show a table by clicking a tickbox?

    Stewea


  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could place the table inside a div and set the visibility property to hidden. Then use the onClick event to perform a function to change the visibility property to visible.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like this:
    Code:
    <html>
    <head>
    <title></title>
    <style type="text/css">
    #tb {
    position:absolute;
    left:100px;
    top:100px;
    width:300px;
    border:1px solid #000000;
    }
    </style>
    <script type="text/javascript">
    function show(id){
    document.getElementById(id).style.visibility = "visible";
    }
    function hide(id){
    document.getElementById(id).style.visibility = "hidden";
    }
    </script>
    </head>
    <body>
    <form>
    <p><input type="checkbox" onclick="show('tb')"> Show table<br>
    <input type="checkbox" onclick="hide('tb')"> Hide it now</p>
    </form>
    <div id="tb"><table width="300" border="1" cellspacing="2" cellpadding="1">
    <tr>
    <td width="50%">Put stuff here..</td>
    <td width="50%">More stuff..</td></tr></table></div>
    </body>
    </html>

  • #4
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its close to what I'm looking for but it uses layers.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There are no layers in that code


  •  

    Posting Permissions

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