Click to return to the Reusing Browser Technology home page    
IHTMLElement::scrollIntoV...     IHTMLElement::toString Me...     IHTMLElement Interface    
Web Workshop  |  Reusing Browser Technology

IHTMLElement::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 (BSTR) that specifies the name of the attribute to set.
AttributeValue
VARIANT structure that contains a 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 (the first to be created with this name). All other attributes of the same name are ignored.

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0

See Also

getAttribute, removeAttribute


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.