> Nope that won't help, thanks anyway..

Switchmenu from Dynamic Drive?  Seems to work very well for me...

if (document.getElementById){  //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var ar = 
document.getElementById("masterdiv").getElementsByTagName("div");
//DynamicDrive.com change
        if(el.style.display != "block"){  //DynamicDrive.com change

// by commenting the next four lines out you are telling the script to keep
submenus open when/if you select another submenu - otherwise, the script
will only allow one submenu open at a time...

            //for (var i=0; i<ar.length; i++){
               // if (ar[i].className=="submenu")  //DynamicDrive.com change
                //ar[i].style.display = "none";
            //}

            el.style.display = "block";
        }else{
            el.style.display = "none";
        }
    }
}

<div id="masterdiv">
<div onclick="SwitchMenu('1')">NAME OF SECTION</div>
<div class="submenu" id="1">
PUT YOUR LIST IN HERE...
</div>

<div onclick="SwitchMenu('Anything')">NAME OF SECTION2</div>
<div class="submenu" id="Anything">
PUT YOUR LIST IN HERE...
</div>
</div>

#masterdiv just has some margin information...nothing special...

good luck...vaska

 
> It's only for one object, ie. the object with an id assigned.
> 
> -----Original Message-----
> From: Cade Whitbourn [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 25 November 2003 2:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [WSG] Modify class (hope to bring closure ;-)
> 
> 
> 
> Not sure if this will help, but it's a solution I copied from Zeldman quite a
> while back...
> 
> <script language="JavaScript">
> function toggle( targetId ){
> if (document.getElementById){
>   target = document.getElementById( targetId );
>    if (target.style.display == "none"){
>     target.style.display = "";
>    } else {
>     target.style.display = "none";
>    }
>  }
> }
> </script>
> 
> <a href="#" onClick="toggle('toggle');return false;">Show</a>
> <div id="toggle" style="display:none">
> <h2>Hello!</h2>
> [<a href="#" onClick="toggle('toggle');return false;">Hide</a>]
> </div>
> 
> Cade.
> 
>> Hi Guys,
>>  
>> I just wanted to touch the subject again, as it did not bring closure to > my
>> problem last time, ie. most of you pointed me in the right direction > but I
>> still don't have it working fully, Lindsay; your example did > display the
>> hidden items but it did not hide them again.
>>  
>> I came up with the following, which also displays the hidden items but >
>> again it does not hide them.
>>  
>> <link href="/style/default.css" rel="stylesheet" type="text/css">
>> <script>
>> function replaceRule( objStyle, className, newClassName )
>> {
>>  var r = objStyle.rules
>>  for ( var i = 0; i < r.length; i++ )
>>  {
>>   if( r[i].selectorText == className )
>>   {
>>    objStyle.removeRule( i );
>>    objStyle.addRule( className, newClassName, i );
>>    return;
>>   }
>>  }
>> }
>> </script>
>> 
>> <a href="##" onClick="replaceRule( document.styleSheets[0], > '.helpItem',
>> '.helpItemDisplay' );">test</a>
>> <div class="helpItem">
>> <img src="#request.imageRoot#/iconHelp.gif" alt="Click here for help > on
>> this item"> Click on any item to display help.</div>
>> 
>> I was also thinking maybe it's easier (if possible) to have two classes >
>> like so;
>>  
>> .international {
>>  visibility: hidden;
>>  display: none; }
>>  
>> .national {
>>  visibility: visible;
>>  display: inline;}
>>  
>> and then do something like switchRule( document.styleSheets[0], >
>> '.international' , '.national' )
>> But how? There doesn't seem to be much documentation out there about >
>> dynamic stylesheets, or a nice PDF Reference, like Netscape brought out > for
>> Client-Side JavaScript Reference
>> 
> 
> *****************************************************
> The discussion list for http://webstandardsgroup.org/
> *****************************************************
> 
> *****************************************************
> The discussion list for http://webstandardsgroup.org/
> *****************************************************
> 
> 
> 



>>>  VASKA DESIGN

        Identities - Communications Design - Interactive Systems

        email: [EMAIL PROTECTED]
        112 rue Sans Souci
        1050 Brussels : Belgium
        tel: 0485/164.411

*****************************************************
The discussion list for http://webstandardsgroup.org/
***************************************************** 

Reply via email to