[thelist] Hiding/showing table rows.

James Aylard webmaster at equilon-mrc.com
Thu Aug 30 13:16:33 CDT 2001


Ryan,

> Could anyone point me to some javascript code that will enable me to
> show/hide rows in a table (all client-side).  I seem to have no luck this
> morning...

    I don't have an article to which to point you, but basically you should
use the CSS display property, toggling its value on a row in order to
display or hide it. Apply "display: none" to a tr in order to hide it, and
"display: block" in order to show it. Actually, I'm a fan of using different
classes: one class for the tr when its showing, and one for when its not,
and changing the value of the tr's className property.
    This will work in IE 5+; not sure about IE 4. Should work in Netscape
6.x, but will not work in Netscape 4.x (which doesn't support dynamic use of
the display property).

James Aylard





More information about the thelist mailing list