Sets or retrieves the object and its content in HTML.
HRESULT IHTMLElement::get_outerHTML(BSTR *p);HRESULT IHTMLElement::put_outerHTML(BSTR v);
- Pointer to a variable of type BSTR that receives content and HTML tags.
- BSTR that specifies content and HTML tags.
Returns S_OK if successful, or an error value otherwise.
The property can be any valid string containing a combination of text and tags.
When the property is set, the given string completely replaces the object, including its start and end tags. If the string contains HTML tags, the string is parsed and formatted as it is placed into the document.
You can set this property only after the onload event fires on the window. When dynamically creating a tag using TextRange, IHTMLElement::innerHTML, or IHTMLElement::outerHTML, use Microsoft JScript to create new events to handle the newly formed tags. Microsoft Visual Basic Scripting Edition (VBScript) is not supported.
To change the contents of the table, tFoot, tHead, and tr elements, use the table object model. For example, use the IHTMLTableRow::rowIndex property or the rows collection to retrieve a reference to a specific table row. To retrieve a reference to a specific cell, use the IHTMLTableCell::cellIndex property or the cells collection. You can add or delete rows using the IHTMLTableRow::insertCell and IHTMLTableRow::deleteCell methods. To change the content of a particular cell, use the IHTMLElement::innerHTML property.
This property is accessible at run time as of Microsoft Internet Explorer 5. Removing elements at run time, before the closing tag has been parsed, can prevent other areas of the document from rendering.