[thelist] Wrapping <tr> groups

Ken Snyder kendsnyder at gmail.com
Mon Jul 16 16:38:16 CDT 2007


Bill Moseley wrote:
> Here's a basic html question.  Is there a way to structurally group
> table rows into groups?
> ...
>
> The idea is departments could all be formatted as a unit and
> "department_employees" can be toggled as a single unit.
>
> Obviously, I can just add class tags to the <tr>, which is what I'm
> currently doing.
>   
You can use <tbody> tags to represent a group of <tr>s.  <tbody> 
sections can then be shown or hidden using javascript:

hide:
document.getElementById('tbody_id').style.display = 'none';

show:
document.getElementById('tbody_id').style.display = '';

I know for sure it works in IE6, IE7 and FF2.

Unless you are using vary large tables, you probably won't notice much 
of a speed difference over using <tr>s with classes.  Why do you want to 
switch?

- Ken Snyder






More information about the thelist mailing list