AndrewBaines
Technical User
I've written a little code to allow list items to be collapsed then shown again as needed. If I initialise the page by hiding everything except the top level, nothing appears on clicking. If I comment out the init code everything works fine with the list appearing and disappearing when clicked.
For the purpose of testing, I've set the class of the top level folders to be empty.
For the code below, init is called onload, then expandcollapse onclick.
Any ideas what's going wrong with init?
My code is:
function init()
{
var coll = document.all.tags("LI");
if (coll != null)
{
for (i=0; i < coll.length; i++)
if (coll.className != '') {
coll.style.display='none';
}
}
}
function expandCollapse ()
{
oSource = event.srcElement;
if (oSource.tagName != "LI")
return;
oChildren = oSource.children;
for (i =0; i<oChildren.length; i++) {
oChild = oChildren;
if (oChild.style.display=='none')
{
oChild.style.display='';
}
else
{
oChild.style.display='none';
}
}
}
Andrew Baines
Chase International
For the purpose of testing, I've set the class of the top level folders to be empty.
For the code below, init is called onload, then expandcollapse onclick.
Any ideas what's going wrong with init?
My code is:
function init()
{
var coll = document.all.tags("LI");
if (coll != null)
{
for (i=0; i < coll.length; i++)
if (coll.className != '') {
coll.style.display='none';
}
}
}
function expandCollapse ()
{
oSource = event.srcElement;
if (oSource.tagName != "LI")
return;
oChildren = oSource.children;
for (i =0; i<oChildren.length; i++) {
oChild = oChildren;
if (oChild.style.display=='none')
{
oChild.style.display='';
}
else
{
oChild.style.display='none';
}
}
}
Andrew Baines
Chase International