Jump to content


This topic is now archived and is closed to further replies.


tabbed menu

Recommended Posts

ok before i start, just need to say that i'll be using tables for this, not divs...

Hi all

right then - in a situation where i have an unknown quantity of button tabs and a <TABLE> for each one, how do i cycle through a group of tables and hide them all bar one?

- how do i setup the tables? (ie, name and ID)
- what's the code to cycle through all the tables and hide them? ie, a nice, clean 'for' loop?

in a nutshell, i know how to show/hide individual tables by referencing it by its ID and changing its style - display:none, etc, but how can i have an 'array' of tables where i can use one simple function to hide them all?

hope someone can help


Share this post

Link to post
Share on other sites
var tbls = document.getElementsByTagName("table");
var i;
for (i = 0; i < tbls.length; i++)
var t = tbls.item(i);
t.style.display = "none";

<table style="display:block;">

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.