views:

576

answers:

6
+3  A: 

Have you tried changing this line

tblRows[i].style.display = (rowVisible) ? "none" : "";

to something like

tblRows[i].style.display = (rowVisible) ? "none" : "table-row";

or

tblRows[i].style.display = (rowVisible) ? "none" : "auto";
Chris Marasti-Georg
That doesn't fix it, and making it "auto" actually breaks things more in IE. :( Thanks, though.
mobiuschic42
A: 

You might want to place your onclick call on the actual <tr> tag rather than the individual <th> tags. This way you have less JS in your HTML which will make it more maintainable.

Lark
Yeah it actually is in the tr tags...I just got frazzles figuring out how to write angle brackets. :)
mobiuschic42
A: 

If you enable script debugging in IE (Tools->Internet Options->Advanced) and put a 'debugger;' statement in the code, IE will automatically bring up Visual Studio when it hits the debugger statement.

17 of 26
When the VS window opens up, it can't find the actual code files since they're named and organized differently in the file system.
mobiuschic42
A: 

I have had issues with this in IE. If I remember correctly, I needed to put an initial value for the "display" style, directly on the HTML as it was initially generated. For example:

<table>
  <tr style="display:none"> ... </tr>
  <tr style="display:"> ... </tr>
</table>

Then I could use JavaScript to change the style, the way you're doing it.

JW
+1  A: 

setAttribute is unreliable in IE. It treats attribute access and object property access as the same thing, so because the DOM property for the 'class' attribute is called 'className', you would have to use that instead on IE.

This bug is fixed in the new IE8 beta, but it is easier simply to use the DOM Level 1 HTML property directly:

img.src= CLOSED_IMAGE;
tbl.className= OPEN_TBL;

You can also do the table folding in the stylesheet, which will be faster and will save you the bother of having to loop over the table rows in script:

table.closed tr { display: none; }
bobince
Yes! This is it! I just noticed that IE is making a *duplicate* class tag instead of changing the existing one...oy.Thanks so much!
mobiuschic42
A: 

I always use style.display = "block" and style.display = "none"