Show All

# name Attribute (button Element)

Used to associate the OnClick event handler of the button with a scripting function.

## Type

    xsd:NMTOKEN

## Remarks

The name attribute is an optional attribute of the button element, but is required for buttons that use scripting code for their actions.

## Example

The following is an example of the name attribute as it is used in the button element:

    <xsf:menuArea name="msoViewMenu">
       <xsf:button caption="CD Collection"
          name="SwitchToView0"></xsf:button>
       <xsf:button caption="All Tracks"
          name="SwitchToView1"></xsf:button>
    </xsf:menuArea>

In the form's internal scripting file, the following event handlers are used for the button actions:

    function SwitchToView0::OnClick()
    {
       XDocument.View.SwitchView("CD Collection");
    }

    function SwitchToView1::OnClick()
    {
       XDocument.View.SwitchView("All Tracks");
    }

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp