Export (0) Print
Expand All

IHTMLDocument2::createStyleSheet method

[IHTMLDocument2::createStyleSheet is no longer supported. Starting with Internet Explorer 11, use document.IHTMLDocument2::createElement('style'). For info, see Compatibility changes.]

Creates a style sheet for the document.

Syntax


IHTMLStyleSheet** createStyleSheet(
  [in, optional]  BSTR sURL,
  [in, optional]  Integer iIndex
);

Parameters

sURL [in, optional]

A BSTR that specifies how to add the style sheet to the document. If a file name is specified for the URL, the style information is added as a link object. If the URL contains style information, it is added to the style object.

iIndex [in, optional]

A long that specifies the index that indicates where the new style sheet is inserted in the styleSheets collection. The default is to insert the new style sheet at the end of the collection.

Return value

A pointer to a styleSheet object.

Remarks

You can create up to 31 styleSheet objects with the IHTMLDocument2::createStyleSheet method. After that, the method returns E_INVALIDARG.


var styleSheet = document.createElement('STYLE');
document.documentElement.firstChild.appendChild(styleSheet);

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IHTMLDocument2

 

 

Community Additions

ADD
Show:
© 2014 Microsoft