Finding DIVs in a page 
Author Message
 Finding DIVs in a page

Hi all,
I need to be able to perform some operations on some DIVs on a page
(show/hide).
There may be several DIVs and I won't know which exist at any time.
Therefore I need to be able to loop
through all the existing DIVs, using something like:

For each DIV in document
    document.all(divs[x]).style.visibility='hidden';
Next

Can anyone advise please
Thanks in advance.
Doug.



Mon, 28 Jun 2004 01:10:16 GMT  
 Finding DIVs in a page
If you don't mind using JScript...

divs=document.all.tags('DIV')

for(i=0;i<divs.length;i++){
    divs[i].style.visibility='hidden'

Quote:
}



Quote:
> Hi all,
> I need to be able to perform some operations on some DIVs on a page
> (show/hide).
> There may be several DIVs and I won't know which exist at any time.
> Therefore I need to be able to loop
> through all the existing DIVs, using something like:

> For each DIV in document
>     document.all(divs[x]).style.visibility='hidden';
> Next

> Can anyone advise please
> Thanks in advance.
> Doug.



Mon, 28 Jun 2004 01:44:11 GMT  
 Finding DIVs in a page
  var divs = document.all.tags('div');
  for (var d = 0; d < divs.length; d++)
     divs[d].style.visibility =

Quote:

> Hi all,
> I need to be able to perform some operations on some DIVs on a page
> (show/hide).
> There may be several DIVs and I won't know which exist at any time.
> Therefore I need to be able to loop
> through all the existing DIVs, using something like:

> For each DIV in document
>     document.all(divs[x]).style.visibility='hidden';
> Next

> Can anyone advise please
> Thanks in advance.
> Doug.

--

        Martin Honnen
        http://javascript.faqts.com/
        http://home.t-online.de/home/martin.honnen/jsgoddies.html



Mon, 28 Jun 2004 06:44:12 GMT  
 Finding DIVs in a page
Cool! Thanks Jeff and Martin!


Quote:
> If you don't mind using JScript...

> divs=document.all.tags('DIV')

> for(i=0;i<divs.length;i++){
>     divs[i].style.visibility='hidden'
> }



> > Hi all,
> > I need to be able to perform some operations on some DIVs on a page
> > (show/hide).
> > There may be several DIVs and I won't know which exist at any time.
> > Therefore I need to be able to loop
> > through all the existing DIVs, using something like:

> > For each DIV in document
> >     document.all(divs[x]).style.visibility='hidden';
> > Next

> > Can anyone advise please
> > Thanks in advance.
> > Doug.



Tue, 29 Jun 2004 01:40:59 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Centering DIVs on a page

2. How can I find the referrent url of the page that calls this page

3. 2nd Post: IFRAME DIVs and form fields

4. IFRAME DIVS and hidden form fields

5. Place Divs

6. Forms elements are not displayed in positioned divs

7. Netscape Divs Seem Strange

8. IE5 + 2-nested-DIVs + innerText

9. DIVs go under

10. 2nd Post: IFRAME DIVs and form fields

11. IFRAME DIVS and hidden form fields

12. Draggable Splitter: Frames or Divs?

 

 
Powered by phpBB® Forum Software