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 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change table>tbody dinamically

    Hi!

    Here's my problem:

    I've got a CSS like:

    Code:
    ...
    table>tbody {
    overflow: auto;
    height: ...
    ...
    }
    and:

    Code:
    <div id="table" class="tableContainer">
    <table cellspacing="0">
    <thead>
    ..
    ..
    </thead>
    <tbody>
    ..
    ..
    </tbody>
    </table>
    </div>
    Is it possible to change the height of '<tbody>'?

    For example:

    var x = document.getelemen(s)tby.... something??
    x.stlye.height = 100 + 'px';

    the css part sould be untouched (it's part of a fixed header table solution)

    Thank you

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,629
    Thanks
    6
    Thanked 1,002 Times in 975 Posts
    If you can change the height of tbody with CSS then you can change it with JavaScript, too, yes.

    Are you actually asking if or how it’s possible to change it?

  • #3
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, my question is how it's possible to change it with javascript.

    Thanks for the help

  • #4
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Problem solved.

    If anybody interested:

    Code:
    var tbody = document.getElementsByTagName('tbody')[0]
    tbody.style.height = 1000 + 'px';


  •  

    Posting Permissions

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