#1
  1. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    14

    Javascript: Change Style?


    Hello,

    in a HTML, there is a invisible table inside a <DIV> tag.
    How can I make it visiable in Javascript?
    Thanks.


    eg.
    <DIV ID="MYTABLE" STYLE="display:none">
    <TABLE>
    ...
    ...
    ...
    </TABLE>
    </DIV>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2001
    Posts
    1,882
    Rep Power
    19
    You'll want to use style="visibility: hidden" to start off with.

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    function showTable()
    {
    document.getElementById('myTable').style.visibility='visible';
    }
    function hideTable()
    {
    document.getElementById('myTable').style.visibility='hidden';
    }
    </script>
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    <p><a href="#" onclick="showTable()">showTable()</a> <a href="#" onclick="hideTable()">hideTable()</a></p>
    
    <DIV ID="myTable" STYLE="visibility:hidden"> 
      <TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#000000">
        <tr><td>this is a table</td></tr>
    </TABLE> 
    </DIV>
    </body>
    </html>
    Will need to add more code for it to work in NS4.
  4. #3
  5. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    14

    thanks


    degsy, thanks a lot for your help

IMN logo majestic logo threadwatch logo seochat tools logo