# Table cells shrink upon re-opening hidden table in Firefox



## Keysbound (Apr 19, 2010)

I have a big, intimidating form. To reduce the intimidation factor, I've hidden the fields so that the user can input a little at a time with no confusion.

When the page opens, it looks fine with the table width at 100% and the table cells filling it in fully. The problem is that when I click the link to hide the table, then re-open it, the table cells shrink down to an unexpected size. This happens in all the browsers (except IE). Here is some example code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Untitled Document

Personal info


Personal Information[/TD]
[TH] [/TD]
[TH] [/TD]
[TH] [/TD]
[TH] [/TD]
[TH] [/TD]
 Spouse's first name:" size="16" />1st Spouse's first name:" size="16"/>  Race
--Select--
Asian
Alaskan Native
American Indian
Black
Hispanic
White
Height: short; medium or tall
--Select--
short
medium
tall
Birth year: " size="16" />
[TH]


----------



## tomdkat (May 6, 2006)

Try changing your "showHideTable()" function to use "display: table" instead of "display: block", which is incorrect for HTML tables:

```
function showHideTable(theTable)
{
if (document.getElementById(theTable).style.display == 'none')
{
document.getElementById(theTable).style.display = '[b][color=red]table[/color][/b]';
}
else
{
document.getElementById(theTable).style.display = 'none';
}
}
```
Your DOCTYPE forces the browser into "Standards" mode, so you'll need to adhere to the web standards to get the desired behavior.

I haven't tried this in IE yet but IE8 should render the page just fine, and IE7 should as well but we'll have to try it to see.

EDIT: IE7 renders the suggested code change above just fine.

EDIT: The above suggested code change doesn't work with IE6 (which is understandable) so you'll need to handle IE6 differently, if you care about IE6 support at all.

Good luck!

Peace...


----------



## Keysbound (Apr 19, 2010)

I played around with your suggestion and made it work. Thank you for taking the time to help.


----------



## tomdkat (May 6, 2006)

Cool. What did you end up doing for IE6? Or did you address IE6 at all? 

Peace...


----------



## Keysbound (Apr 19, 2010)

I bagged on IE 6 but I'll look at it in a day or so when I've deployed all this to the various pages that need it. I had nearly finished this project when I decided to review it in FF. Oops... so I'm eager to get it all fixed before tackling that 'final' annoyance.


----------



## tomdkat (May 6, 2006)

Ok, sounds good. 

Good luck!

Peace...


----------

