P
pbd22
Hi.
How do I get all the elements that are "just" one level down from the
parent element? I tired:
var mycont = document.getElementById('mycontent');
var litems = mycont.getElementsByTagName("div");
hoping that this would produce all the div elements that are
just below the parent element but it seems to return "all" the
div elements contained by the parent element.
Below is the meat of the method. I want to hide all div elements
that are not the element clicked on by the user (using display:none).
var mycont = document.getElementById('mycontent');
var litems = mycont.getElementsByTagName("div");
for (var i = 0, l = litems.length; i < l; i++)
{
var li = litems;
if (li.style.display == "")
{
li.style.display = "none";
// alert(li.id);
}
}
what this currently does is completely hide all the elements contained
in "mycontent".
Thanks for your help.
How do I get all the elements that are "just" one level down from the
parent element? I tired:
var mycont = document.getElementById('mycontent');
var litems = mycont.getElementsByTagName("div");
hoping that this would produce all the div elements that are
just below the parent element but it seems to return "all" the
div elements contained by the parent element.
Below is the meat of the method. I want to hide all div elements
that are not the element clicked on by the user (using display:none).
var mycont = document.getElementById('mycontent');
var litems = mycont.getElementsByTagName("div");
for (var i = 0, l = litems.length; i < l; i++)
{
var li = litems;
if (li.style.display == "")
{
li.style.display = "none";
// alert(li.id);
}
}
what this currently does is completely hide all the elements contained
in "mycontent".
Thanks for your help.