Re: Hiding a table row in Firefox

Giganews Newsgroups
Subject: Re: Hiding a table row in Firefox
Posted by:  rf (rf@z.invalid)
Date: Wed, 14 Oct 2009

"Patrick Nolan" <p…@glast2.Stanford.EDU> wrote in message
news:slrnhdcmke.g0h.p…@www-glast.stanford.edu...
> There is an HTML table with two columns.  I would like to hide
> or reveal a row by clicking a box.  I worked out a way to do it
> which works for IE, but the result surprises me in Firefox.
>
> The HTML for the row looks like this:
> <tr id=foobar><td>data</td><td>Some text</td></tr>
>
> The button which controls it looks like this:
> <input type=button value="Flip the row" onClick="toggle('foobar');">
>
> The function that does the work is
> function toggle(element) {
>  var el = document.getElementById(element);
>  if (el.style.display == "none") el.style.display = "block";
>  else el.style.display = "none";
> }

This is not a Javscript problem, it's a CSS one.

Table rows are not display: block, they are display: table-row. IE is either
error correcting what you are doing or is dense enough to be able to display
the row as you want it.

If you want to turn off display: none then
el.style.display = "";

Replies

In response to

Hiding a table row in Firefox posted by Patrick Nolan on Wed, 14 Oct 2009