getItem Method

Retrieves an item at a specified index on the Toolbar object.

Syntax

ToolbarItem = TOOLBAR.getItem(iIndex)

Parameters

iIndex Required. Integer that specifies which index position on the Toolbar to find the item to access.

Return Value

The item or null.

Example

The following example shows how to use the getItem method to return any item on a Toolbar and then delete the item.


<HTML xmlns:mytb>
<?import namespace="mytb" implementation="toolbar.htc">
<SCRIPT LANGUAGE="JScript">
function deleteItem(index)
{
    // Retrieve the item specified using the getItem method.
    var item = oToolBar.getItem(index);
    if (item != null)
        item.remove();
}
</SCRIPT>

<BODY STYLE="font-family:verdana;font-size:x-small;">

Index: <input type="text" size="3" id="oIndex" value="0" ></input>
<BR>
<P><button onclick="deleteItem(oIndex.value)">Delete</button>
<P>
<mytb:toolbar id="oToolBar">
<mytb:toolbarbutton imageUrl="/WebControls/graphics/tool-mail.gif" 
title="Send New Mail Message"/>
<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="tool-calendar.gif" 
text="Meetings" title="Turn on meeting reminders"/>
</mytb:toolbar>

</BODY>
</HTML>       

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

Applies To

TOOLBAR

See Also

Internet Explorer WebControls, About the Toolbar WebControl