Gets the HtmlElement for the BODY tag.
Public ReadOnly Property Body As HtmlElement
public HtmlElement Body { get; }
public: property HtmlElement^ Body { HtmlElement^ get (); }
member Body : HtmlElement
An HTML document is split into two major sections:
HEAD, which contains the document's title, any document meta-data, and SCRIPT elements.
BODY, which contains all of the elements involved in the on-screen appearance of the document.
There is no equivalent Head property on HtmlDocument. To obtain the HEAD element, use GetElementsByTagName.
The following code example creates a new DIV element and appends it to the bottom of the document using the AppendChild method.
Private Sub AppendText(ByVal Text As String) If (WebBrowser1.Document IsNot Nothing) Then With WebBrowser1.Document Dim TextElem As HtmlElement = .CreateElement("DIV") TextElem.InnerText = Text .Body.AppendChild(TextElem) End With End If End Sub
private void AppendText(String text) { if (webBrowser1.Document != null) { HtmlDocument doc = webBrowser1.Document; HtmlElement textElem = doc.CreateElement("DIV"); textElem.InnerText = text; doc.Body.AppendChild(textElem); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2