0

If someone can help: Try to hide/show some rows in a HTML table, setting the style display:none or display:block attributes in some table rows. The problem is that if I set the display:block, seems to every data in one column, the expanded rows are lost the width of the table cells.

It is currently Firefox browser.

The toggle script is:

<script language="javascript">
  function toggle_it(itemID){   
  // Toggle visibility between none and inline
 var Nondisp = document.getElementsByClassName(itemID) 
 for( var i=0; i < Nondisp.length ; i++) 
{
  if ((Nondisp[i].style.display == 'none'))   
    {                                                              
     Nondisp[i].style.display = 'block';     
      } else {                                                     
      Nondisp[i].style.display = 'none';      
      }                                                            
  }                                                                
  }                                                                
</script>  
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

2 Answers2

0

Check out the difference between Display:None and Visibility:Hidden at: What is the difference between visibility:hidden and display:none?

Setting visibility to hidden should still allocate the room in your table where your current setting of display:none completely removes the item from layout considerations.

Community
  • 1
  • 1
nvuono
  • 3,323
  • 26
  • 27
0

Use table-row instead of block.

Ole Sørensen
  • 349
  • 5
  • 19