Oh, I know its obscenely invalid, its just a placeholder, since I actually have no clue what to put there. Basically, I have this code that expands and collapses divs within an element. That element is a hidden element that shows up when the user clicks a button elsewhere on the page.
My problem is, there are three of these hidden elements, and I want the expanded elements to collapse when another hidden element is revealed, so that when the user switches between elements, the ones they've clicked on already are not shown.
The placeholder code uses the pseudo-classes set up in the function, but I don't know what sort of syntax I should be using.
Code:
window.onload = function ()
{
setupDivs( "test", "test2", "test3" );
};
function setupDivs()
{
var bob, args = arguments;
for( var i = 0; arguments[ i ]; i++ )
{
bob = document.getElementById( arguments[ i ] );
if (bob)
{
bob.className = 'unactive';
bob.getElementsByTagName( '*' )[0].onclick = f;
}
}
//??????????
{
if ("parentElement".hidden=true);
{
childNode.unactive=true;
}
}
//????????????
function f()
{
this.parentNode.className = (this.parentNode.className == 'unactive') ? 'active' : 'unactive' ;
}
}