Click to return to the DHTML, HTML     
closeAll Method     Behaviors Library    
Web Workshop  |  DHTML, HTML & CSS

menu Behavior


Adds an expandable/collapsible menu to the document.

Syntax

XML<Prefix:CustomTag ID=sID STYLE="behavior:url('expand.htc')" />
HTML<ELEMENT STYLE="behavior:url('expand.htc')" ID=sID>
Scriptingobject.style.behavior = "url('expand.htc')"
object.addBehavior ("expand.htc")

Possible Values

Prefix Prefix used to associate CustomTag with a namespace. This prefix is set using the XMLNS attribute of the HTML element.
CustomTag User-defined tag.
sID String that uniquely identifies the object.

Members

Styles

Remarks

The behavior-defined members listed in the preceding table are not accessible through script until the window.onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

The menu behavior allows authors to create expanding and collapsing menus on Web pages. Each menu node can enclose other nodes or standard HTML elements, such as an anchor.

The expand.htc file can be downloaded from the menu sample page.

In addition to the members and styles previously listed, the menu behavior supports:

Example

This sample demonstrates the implementation and adjustments of the menu behavior.

<HTML XMLNS:Menu>
<HEAD>
<STYLE>
@media all{
   Menu\:node{
      behavior: url(/behaviors/expand.htc) ;
   }
}
</STYLE>
</HEAD>
<BODY>
<Menu:node>List 1
<Menu:node>Item 1</Menu:node>
<Menu:node>Item 2</Menu:node>
<Menu:node>Item 3</Menu:node>
</Menu:node>
</BODY>
</HTML>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

See Also

DHTML Behaviors, Using DHTML Behaviors



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.