Export (0) Print
Expand All

menu Behavior

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

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>
Scripting object .style.behavior = "url('expand.htc')"
object .addBehavior ("expand.htc")

Possible Values

Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
CustomTag User-defined tag.
sID String that specifies a unique identifier for the object.

Members Table

The following table lists the members exposed by the menu object.

Attributes/Properties
Attribute Property Description
IMGCLOSE imgClose Specifies the source path of the image to display when a menu is expanded for the menu behavior.
IMGEXPAND imgExpand Specifies the source path of the image to display when a menu is closed for the menu behavior.
masterState Retrieves whether the overall state of the menu is closed or expanded for the menu behavior.
mv--indent mvIndent Sets or retrieves the indentation for each menu level in the menu behavior.
state Retrieves whether the state of a particular menu is closed or expanded for the menu behavior.
Events
Event Property Description
oncloseall Fires when all entries in the menu are closed by invoking the closeAll method for the menu behavior.
onclosenode Fires when a menu node is closed for the menu behavior.
onerror Fires when a property is assigned an invalid value, or the property is read-only, for the menu behavior.
onexpandall Fires when all entries in the menu are expanded by invoking the expandAll method for the menu behavior.
onexpandnode Fires when a menu node is expanded for the menu behavior.
Methods
Method Description
closeAll Closes all menu items for the menu behavior.
closeNode Closes the specified menu node for the menu behavior.
expandAll Expands all menu items for the menu behavior.
expandNode Expands the specified menu node for the menu behavior.

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 document is completely loaded, that all behaviors have been applied to corresponding elements on the document , 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 . 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>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/library/menu/expand_js.htm

See Also

Community Additions

ADD
Show:
© 2014 Microsoft