Click to return to the Reusing Browser Technology home page    
IHTMLEventObj2::removeAtt...     IHTMLFieldSetElement Inte...     IHTMLEventObj2 Interface    
Web Workshop  |  Reusing Browser Technology

IHTMLEventObj2::setAttribute Method


Sets the value of the given attribute. If the attribute is not already present, the method adds the attribute to the element and sets the value.

Syntax

HRESULT setAttribute( 
    BSTR strAttributeName,
    VARIANT AttributeValue,
    VARIANT_BOOL fCaseSensitive 
);

Parameters

strAttributeName
String that specifies the name of the attribute to set.
AttributeValue
String, number, or Boolean value to assign to the attribute.
fCaseSensitive
Boolean value that specifies whether to use a case-sensitive search to locate the attribute. If TRUE, the uppercase and lowercase letters in strAttributeName must match exactly those in the attribute name.

Return Value

Returns S_OK if successful, or an error code otherwise.

Remarks

Be careful when spelling attribute names. If fCaseSensitive is TRUE and strAttributeName does not have the same uppercase and lowercase letters as the attribute, this method creates a new attribute.

If two or more attributes have the same name—differing only in uppercase and lowercase letters—and fCaseSensitive is FALSE, this method assigns values only to the first attribute to be created with this name. All other attributes of the same name are ignored.

This method is used only by events created from HTML Components.

See Also

getAttribute, IHTMLStyle


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.