Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I hide a column in a Table?

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

I have a Table in an HTML document, and I want to hide one of the columns (like you can in Excel for example).

I've tried setting the Width to 0 but it simply resizes the column to the longest word. Is there a way to do this? Any solution only need work in IE.

- Andy.
 
that will work in the corse code, as for a dynamic solution, this should work:

<style type=&quot;text/css&quot;>
.hide{display:none;}
.show{display:inline;}
</style>
<script type=&quot;text/javascript&quot;>
function showHide(id){
if (id.className == &quot;show&quot;){
id.className = &quot;hide&quot;
}else if (id.className == &quot;hide&quot;){
id.className = &quot;show&quot;
}
}
</script>

...

<table>
<tr><td><a href=&quot;javascript:showHide(trOne);&quot;>Show/Hide Table row</a></td></tr>
<tr id=&quot;trOne&quot; class=&quot;show&quot;><td>some stuff to be hidden</td></tr>

<tr><td><a href=&quot;javascript:showHide(trTwo);&quot;>Show/Hide Table row</a></td></tr>
<tr id=&quot;trTwo&quot; class=&quot;show&quot;><td>some stuff to be hidden</td></tr>
</table>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top