View Full Version : A collection of Divs?

10-16-2003, 02:07 PM
I would like to run a javascript for loop for each div that is within a containing div. Is there a way to identify the contained divs?

10-16-2003, 02:56 PM
getElementsByTagName is a method of all Element objects, so you can do somehting like this:
var cDivs=document.getElementById('yourContainerDiv').getElementsByTagName('div');

10-26-2003, 11:59 PM
Thanks Liorean,

I have just today been able to get back to my toy. Work has prevented me from doing useful things.

Looking at a collection of my posts one can see that divs give me a lot of trouble. I either can't get a reference to one, can't get the css to apply to one, I've got them hiding behind other content, or some such thing.

I finally got the divs to line up properly and was able to identify each one with code. Now I can work on getting my popup div from hiding behind the xml document being displayed.

I appreciate your help.