Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] visibility of a table column


  • From: jdeighan at pcgus.com (John Deighan)
  • Subject: [Javascript] visibility of a table column
  • Date: Tue Oct 10 15:10:15 2006

I need to set the visibility of an entire column to hidden or 
visible. I was hoping that the following would work:

<table>
<colgroup>
	<col id="col1">
	...
</colgroup>
....
</table>

<button onclick="document.getElementById('col1').style.visibility = 'hidden';">
	Hide Column 1
</button>

However, when I try it, it doesn't work. Is it supposed to? I realize 
that I can set the visibility of all cells in that column, but it 
might be a very large table. I am using Firefox.

Actually, while composing this e-mail, I decided to try this under IE 
6. It sort of works. It hides the contents of the cells in that 
column. However, it doesn't make the column go away - in fact, the 
column retains its former width, so I assume it's computing that 
width from the data, which is still really there. To be honest, this 
seems like an odd solution, since it's the column's visibility that 
I'm setting, not the content of the column's cells. Does anyone know 
what the behaviour is supposed to be?