IHTMLElement2::currentStyle Property
Gets a reference to the currentStyle object, which represents the current cascaded format and style specified by global style sheets, inline styles, and HTML attributes.
Syntax
HRESULT IHTMLElement2::get_currentStyle(IHTMLCurrentStyle **p);
Parameters
- p
- Address of a pointer to a variable of type IHTMLCurrentStyle interface that receives the cascaded style of the object.
Return Value
Returns one of the following values.
S_OK The operation completed successfully. W3CException_DOM_NO_MODIFICATION_ALLOWED_ERR An attempt is made to modify an object that cannot be changed.
Remarks
The values returned by the properties of the IHTMLStyle and IHTMLCurrentStyle interfaces differ when the style of an object is not set inline. For example, if the author of a Web page sets the color property of a paragraph to
redonly through a linked or embedded style sheet, and not inline, then the IHTMLCurrentStyle::color property returns the valuered, and the IHTMLStyle::get_color property does not return a value. However, if the author specifies the value of the color property inline, as in the following example, both the IHTMLCurrentStyle::color and IHTMLStyle::get_color properties return the valuered.<P STYLE="color:'red'">In Windows Internet Explorer 8 and earlier, the IHTMLElement2::currentStyle property returns E_MEMBERNOTFOUND if script attempts to write to it.
See Also
IHTMLElement::style