Expandable menu 
Author Message
 Expandable menu

Hi,

I want to create a simple menu of items.  Suppose I have three main menu
items:

    Menu1
    Menu2
    Menu3

When a user clicks on Menu1, I want it to expand to reveal sub menu items.
When a user clicks on Menu1 once again, I want it to retract and hide its
sub menu items.

    Menu1
       SubMenu1
       SubMenu2
    Menu2
    Menu3

Like wise behavior for Menu2 and Menu3.

How do I do it?

Thanks.



Tue, 07 Sep 2004 04:37:52 GMT  
 Expandable menu
http://www.google.com/search?q=dhtml+expand+menu

There are probably hundreds of examples of dhtml expandable menus out there...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> Hi,

> I want to create a simple menu of items.  Suppose I have three main menu
> items:

>     Menu1
>     Menu2
>     Menu3

> When a user clicks on Menu1, I want it to expand to reveal sub menu items.
> When a user clicks on Menu1 once again, I want it to retract and hide its
> sub menu items.

>     Menu1
>        SubMenu1
>        SubMenu2
>     Menu2
>     Menu3

> Like wise behavior for Menu2 and Menu3.

> How do I do it?

> Thanks.



Tue, 07 Sep 2004 04:57:36 GMT  
 Expandable menu
to make "collapsible menus" use the display property of a div ...
<script>
function toggleChildren(el)
{
 var ChildDocumentAllIndex = el.sourceIndex + 1;
 var ChildMenuEl = document.all[ChildDocumentAllIndex];
 if(ChildMenuEl.style.display == "inline")
  ChildMenuEl.style.display = "none";
 else
  ChildMenuEl.style.display = "inline";
Quote:
}

</script>
<h1 onclick="toggleChildren(this)">menu1</h1>
<div style="display: none;">
  subitem 1, 1<br>
  subitem 1, 2
</div>
<h1 onclick="toggleChildren(this)">menu2</h1>
<div style="display: none;">
  subitem 2, 1<br>
  subitem 2, 2
</div>
<h1 onclick="toggleChildren(this)">menu3</h1>
<div style="display: none;">
  subitem 3, 1<br>
  subitem 3, 2
</div>

this is ie4+ specific code not ns supported because of document.all
notice how we change the display property of the style object from none to
inline

etan



Sun, 12 Sep 2004 22:30:35 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. menus and sub-menus and sub-sub-menus

2. Sub Menu - Child Menu

3. Mouseover menus, & ms menus

4. Slow Menu load on ASPX page (menu as control)

5. real (expandable ?) memory vs. vmstatus

6. Open Browser without Menu, Nav or Address Bars

7. Context/Regular Menus

8. IE SaveAs menu items not appearing

9. Accessing the 'File' menu

10. menu/list question (simple)

11. Context Menu Functionality and VBScript

12. How do i setup menus

 

 
Powered by phpBB® Forum Software