Share via


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");
}

Parent Objects | button Element