[thelist] collapsible elements without using IDs

Christian Heilmann lists at onlinetools.org
Mon Dec 6 18:52:57 CST 2004

>function toggleExpanded(oelement)
>	if (oelement && oelement != null)
>	{
>		// toggle expanded/collapsed
>		if (oelement.className && oelement.className != null)
>			oelement.className =
>		else
>			oelement.className = 'collapsed';
>		// end if
>	} // end if
>(also, is the if I'm using to check for a valid object redundant? I'm
>not sure if the first condtion could ever return true yet the object
>is still null)
>Any help would be greatly appreciated.
Yes, it is redundant, especially when you call this function from the 

What you can do is to add this function onclick to each A element inside 
one with an ID by looping through its document.getElementByTagName('a') 
array then your function should apply the above functionality to the 
next sibling. An example would be the demo page of the cssjs function:




P.S: Never, under _any_ circumstances use javascript: as a link 
protocol. It is a bad habit that MUST die.

More information about the thelist mailing list