[Javascript] visibility of a table column

Liam Rice Liam.Rice at autodata.net
Tue Oct 10 15:28:20 CDT 2006


Sounds like you are trying to remove the column from the page.  I did
this one time and found that I had to make the columns into separate
tables within the columns, making it possible to hide just that one
table cell.  But I think the property you are looking for is display,
rather than visibility.  

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of John Deighan
Sent: Tuesday, October 10, 2006 4:10 PM
To: javascript at LaTech.edu
Subject: [Javascript] visibility of a table column


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?

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list