Share via


NUMITEMS Attribute | numItems Property

Returns the number of top-level items of the Toolbar object.

Syntax

HTML <namespace:TOOLBAR NUMITEMS = iNumItems... >
Scripting TOOLBAR.numItems [ = iNumItems ]

Possible Values

namespace Prefix that associates a custom tag with an XML namespace. This prefix is set using the XMLNS attribute of the html tag.
iNumItems Integer that specifies or receives the number of top-level items in the Toolbar.

The property is read/write. The property has no default value.

Example

The following example shows how to use the numItems property to find the number of top-level items on the Toolbar object.


<HTML XMLNS:mytb>
<?import namespace="mytb" implementation="toolbar.htc">
<HEAD>
<TITLE>Toolbar Client Behavior</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JScript">
function fnAction()
{
    var srcNode = event.srcElement;
    if (srcNode != undefined)
    {
        debug.innerText = oToolBar.numItems;
    }
}
</SCRIPT>
<BODY STYLE="font-family:verdana;font-size:x-small;">
<mytb:toolbar id="oToolBar" >
<mytb:toolbarlabel text="Sample:" />
<mytb:toolbarbutton imageUrl="tool-mail.gif"/>
<mytb:toolbarcheckgroup>
    <mytb:toolbarcheckbutton text="Item 1" />
    <mytb:toolbarcheckbutton text="Item 2" />
    <mytb:toolbarcheckbutton text="Item 3" />
</mytb:toolbarcheckgroup>
<mytb:toolbarseparator />
<mytb:toolbarbutton imageUrl="tool-reply.gif" Text="Reply" title="Reply"/>
<mytb:toolbarbutton imageUrl="tool-reply_all.gif" Text="Reply All" 
title="Reply to All" DefaultStyle="font-weight:bold" HoverStyle="color:blue" 
SelectedStyle="color:red" />
<mytb:toolbarbutton imageUrl="tool-forward.gif" Text="Forward" 
title="Forward" DefaultStyle="font-style:italic" />
<mytb:toolbarseparator />
<mytb:toolbarcheckbutton selected="true" imageurl="images/tool-calendar.gif" 
text="Meetings" title="Turn on meeting reminders" />
<mytb:toolbarseparator />
<mytb:toolbarbutton DefaultStyle="font-weight:bold;color:green;" accesskey="m" 
onclick="fnAction()">Click <u>M</u>e</mytb:toolbarbutton>
</mytb:toolbar>
</P>
<P>Number of Items: <SPAN ID=debug STYLE="background:beige; border:solid 1px black;width:400;"></SPAN>
</P>

</BODY>
</HTML>

Code example: https://samples.msdn.microsoft.com/workshop/samples/webcontrols/toolbar/numItems.htm

Applies To

TOOLBAR

See Also

Internet Explorer WebControls, About the Toolbar WebControl