"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:vL******************@text.news.blueyonder.co. uk...
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:cs*******************@news.demon.co.uk... Kiran Makam wrote: > my_tbody_element.style.display="block";
<snip> function toggle(tbody){
var displayVal = (document.all)? "block" : "table-row";
<snip> Tested in NS7 and IE6.
But testing in Opera, Safari, Konqueror or IceBrowser would have
revealed how limited this approach is. The assumption that a browser
implementing document.all is IE has not been valid for many years
now.
I would go along with Martin Honnen in this an use a technique that
works cross-browser.
Well I guess there is no such thing as a guaranteed cross-browser
solution when you're dealing with something like IE that is not
standards-compliant.
You are correct, there is no such thing as a guaranteed cross-browser
solution, but for the wrong reason. The problem is that some browsers
may not have a Style object as a property of each HTML element, or it
may support the Style object as a property but may not dynamically
update the screen when Style properties are changed via script.
However, the types of problems outlined above are not what you are
referring to. You want a simple solution that will allow you to
change -display- property of a TBODY from "none" back to the default
state (table-row-group), but IE does not support a -display- property
value of "table-row-group".
So, the solution is what Martin told you, and Richard referred you to
that solution.
The only possibility is that Martin's post did not appear on your news
server. In that case, I'll quote Martin's original post:
It should suffice to set
my_tbody_element.style.display = "";
if all display to none settings are done with script as you have above.
Only if you had style rules in a style sheet e.g.
tbody { display: none; }
the script setting the inline style
style.display = "";
could not show the element as an empty inline style obviously doesn't
override a style rule.
So the solution is to set TBODY.style.display = ""; (empty string). This
will result in the HTML element displaying it's content using the
default display mechanism for that element (block for <div>, inline for
<span>, table-row-group for <tbody>, etc).
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq