vendredi 2 août 2019

Show/Hide more than one with a checkbox

I want to show and hide several tables on one page with one button. Unfortunately my script can only show and hide one table at a time.

I have a page with a lot of queries. There are also text fields in a table. For a better overview, the tables with the text fields should only be displayed when the checkbox is ticked. The checkbox should not be clicked at the beginning.

function Displayer(n)
{
  var check = document.getElementById('Section'+n);
  if (check.style.display == 'none')
    {
      check.style.display='inline';
    }
    else
    {
      check.style.display='none';
    }
}
<p><input type="checkbox" class="btnstylega" onClick="Displayer(99)" />Show Tables</p>

<table id="Section99" style="display:none;"> <td>
AAAAAAAAAAAAAA
</td></table>

<table id="Section99" style="display:none;"> <td>
BBBBBBBBBBBBBBB
</td></table><br>

I want to show and hide many tables without adjusting the tables by clicking on the checkbox.




Aucun commentaire:

Enregistrer un commentaire