getAttribute Method

Retrieves the value of the specified attribute.

Syntax

vAttrValue = object.getAttribute(sAttrName)

Parameters

sAttrName Required. String that specifies the name of the attribute.

Return Value

Variant that returns a String, number, or Boolean value as defined by the attribute. If the attribute is not present, this method returns null.

Example

The following example shows how to use the getAttribute method to return the value of an attribute.


<HTML xmlns:mytb>
<?import namespace="mytb" implementation="toolbar.htc">
<HEAD>
<SCRIPT>
function fnChangeStyle()
{
    var oButton = event.srcNode;
    alert(oButton.getAttribute("defaultstyle"));
}
</SCRIPT>
</HEAD>

<BODY>

<mytb:TOOLBAR STYLE="display:inline" onbuttonclick="fnChangeStyle();" ID="oToolBar">

<mytb:TOOLBARLABEL TEXT="BUTTON:" />
<mytb:TOOLBARBUTTON IMAGEURL="/workshop/graphics/tool-mail.gif" 
TEXT="Click Me" 
DEFAULTSTYLE="background-color:#FFFFFF; color:#000000"
HOVERSTYLE="background-color:#FFFFCC; color:#666666"
SELECTEDSTYLE="color:#FF0033; border:1px solid #000000"
 />
 
</mytb:TOOLBAR> 

</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/webcontrols/toolbar/getAttribute.htm

Applies To

TAB, TABSEPARATOR, TOOLBARBUTTON, TOOLBARCHECKBUTTON, TOOLBARCHECKGROUP, TOOLBARDROPDOWNLIST, TOOLBARLABEL, TOOLBARSEPARATOR, TOOLBARTEXTBOX, TREEVIEW, TREENODETYPE, TREENODE

See Also

Internet Explorer WebControls, About the TabStrip WebControl, About the Toolbar WebControl, About the TreeView WebControl, DEFAULTSTYLE, HOVERSTYLE, orientation, selectedIndex, SELECTEDSTYLE, SEPDEFAULTIMAGEURL, SEPDEFAULTSTYLE, SEPHOVERIMAGEURL, SEPHOVERSTYLE, SEPSELECTEDIMAGEURL, SEPSELECTEDSTYLE, TABDEFAULTSTYLE, TABHOVERSTYLE, TABSELECTEDSTYLE, TARGETID, FORCESELECTION, MAXLENGTH, SELECTED, CHECKBOX, CHECKED, CHILDTYPE, EXPANDABLE, EXPANDED, EXPANDEDIMAGEURL, expandLevel, IMAGEURL, NAVIGATEURL, selectExpands, SELECTEDIMAGEURL, showLines, showPlus, systemImagesPath, TARGET, TREENODESRC, treeNodeTypeSrc, TREENODEXSLTSRC, TYPE