Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22281

Re: best method to "hide" a whole <table> column ?

Newsgroups comp.lang.javascript
Subject Re: best method to "hide" a whole <table> column ?
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <4a645078$0$292$7a628cd7@news.club-internet.fr> <8d349f92-a64b-4837-9f00-cbcc4d07f985@k19g2000yqn.googlegroups.com> <0a06e88a-f13d-4ced-a49a-361556b80643@googlegroups.com> <l87tmt$860$2@dont-email.me>
Message-ID <XnsA292EFFF5D177eejj99@194.109.133.246> (permalink)
Date 2013-12-10 22:35 +0000

Show all headers | View raw


Denis McMahon wrote on 10 dec 2013 in comp.lang.javascript:

> function hide(tid,c,h=true){
>   var i,t=document.getElementById(tid);
>   for(i=0;i<t.rows.length;i++)
>     t.rows[i].cells[c-1].style.display=h?"none":"table-cell";
>}

no need for a loop [chrome tested]:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
td {font-size:25pt;}
.tx td:first-child + td {display:none;}
</style> 
<script>
function toggle(t){ 
   t.className = (t.className == '') ?'tx' :'';
};
</script>
</head> 
<body>
<table onclick = 'toggle(this)' border = 1>
<tr><td>1<td>2<td>3
<tr><td>1<td>2<td>3
<tr><td>1<td>2<td>3
<tr><td>1<td>2<td>3
</table>
click on table to toggle row 2
</body> 
</html>

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: best method to "hide" a whole <table> column ? kumarcherukuris@gmail.com - 2013-12-10 09:02 -0800
  Re: best method to "hide" a whole <table> column ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-10 19:20 +0000
  Re: best method to "hide" a whole <table> column ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-10 20:31 +0000
    Re: best method to "hide" a whole <table> column ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2013-12-10 22:35 +0000
      Re: best method to "hide" a whole <table> column ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-11 00:16 +0000
      Re: best method to "hide" a whole <table> column ? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2013-12-11 11:16 +0100
        Re: best method to "hide" a whole <table> column ? Nisse Engström <news.NOSPAM.uvex6@luden.se> - 2014-02-15 02:38 +0100
      Re: best method to "hide" a whole <table> column ? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-11 11:23 -0200
        Re: best method to "hide" a whole <table> column ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-11 19:16 +0000
    Re: best method to "hide" a whole <table> column ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-11 00:22 +0100
      Re: best method to "hide" a whole <table> column ? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-11 14:36 -0200
        Re: best method to "hide" a whole <table> column ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-11 18:27 +0100
        Re: best method to "hide" a whole <table> column ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-11 19:23 +0000
          Re: best method to "hide" a whole <table> column ? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-11 22:08 -0200

csiph-web