Results 1 to 2 of 2

Thread: expanding table

  1. #1
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default expanding table

    hiya guys,
    I was wondering if there was a way in which you could have rows on a table made with html that are hidden when the page loads but when you clicked on the row above, it would expand out the previously hidden content below it. Any idea how to do that?
    thanks,
    bernie

  2. #2
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function showTable() {
    	document.getElementById('showMe').style.display = "block";
    }
    </script>
    </head>
    <body>
    <table border="1">
    <tr onclick="showTable()">
    <td>Text 1</td>
    <td>Text 2</td>
    </tr>
    <tr style="display:none;" id="showMe">
    <td>Text 3</td>
    <td>Text 4</td>
    </tr>
    </table>
    </body>
    </html>

  3. The Following User Says Thank You to keyboard For This Useful Post:

    bernie1227 (05-21-2012)

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
  •