Jump to content


tabbed menu

  • Please log in to reply
1 reply to this topic

#1 redbullmarky

  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 26 February 2006 - 05:55 PM

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

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#2 ccl

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 08 March 2006 - 11:56 PM

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;">

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users