[Javascript] hiding single td cells

Steve Clay sclay at ufl.edu
Tue Apr 25 08:34:48 CDT 2006


Tuesday, April 25, 2006, 8:54:20 AM, Michael Borchers wrote:
>> Where are you testing? Internet Explorer doesn't support display:
>> table-cell. You should toggle between "none" and "".

> and thanks to IE :(

IE not supporting table display properties does cause this particular
problem, but resetting style properties to an empty string is a good
general method of allowing element style properties to return to their
value defined in the CSS.

For example, a generic "toggle" script should toggle display between "none"
and "" (instead of "block") because you can then safely restore inline
elements, table cells, table rows, etc.

One thing to look out for is that Safari may require you to reset each
property of a shorthand property. If you set el.style.background = 'red',
to restore the background completely you need:

with (el.style) {
    background = backgroundColor = backgroundImage = backgroundRepeat =
    backgroundAttachment = backgroundPosition = '';
}

Another reason why classNames are the way to go if you can.

Steve
-- 
http://mrclay.org/




More information about the Javascript mailing list