[thelist] DOM - grouping <TR> tags

Peter-Paul Koch gassinaumasis at hotmail.com
Fri Mar 16 06:12:04 CST 2001


><tr style="display: inline" ID=LOCAL3>
>
>that I would like to turn on/off with an event:
>
>onClick="LOCAL3.style.display='none';"
>
>The question: How to I capture multiple rows without using multiple ID's,
>i.e. LOCAL1, LOCAL2 etc.?

There's no direct way, but you can give your TR's a CLASS and then do

var x = document.getElementsByTagName('TR');
for (i=0;i<x.length;i++)
  if (x[i].className="yourclass") x[i].style.display = 'none';

(wish they'd built in a document.getElementsByClassName() method)

ppk

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the thelist mailing list