Export (0) Print
Expand All

setAttribute Method

Sets the value of the specified attribute.

Syntax

object.setAttribute(sAttName, vAttrValue)

Parameters

sAttName Required. String that specifies the name of the attribute.
vAttrValue Required. Variant that specifies the String, number, or Boolean to assign to the attribute.

Return Value

No return value.

Example

The following example shows how to use the setAttribute method to change the value of an attribute of a ToolbarButton.



<HTML xmlns:mytb>
<?import namespace="mytb" implementation="toolbar.htc">
<HEAD>
<SCRIPT>
function fnChangeStyle()
{
    var oButton = event.srcNode;
    oButton.setAttribute("text", "I was clicked!");
}
</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/setAttribute.htm

Applies To

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

See Also

Show:
© 2014 Microsoft