
This interface provides access to the BODY object.
This interface specifies the beginning and end of the document body.
Use the IHTMLDocument2::get_body method to retrieve a pointer to the IHTMLBodyElement interface for a document's BODY object.
The BODY element is a block element.
IHTMLBodyElement Methods
HRESULT put_background(
BSTR v
);
Sets a background picture. The picture is tiled behind the text and graphics on the page.
See also get_background
HRESULT get_background(
BSTR *p
);
Retrieves the URL of the background picture, if any. The picture is tiled behind the text and graphics on the page.
See also put_background
HRESULT put_bgProperties(
BSTR v
);
Sets the properties for the background picture. For example, specifies whether the picture is a fixed watermark or scrolls with the page
See also get_bgProperties
HRESULT get_bgProperties(
BSTR *p
);
Retrieves the properties for the background picture; for example, whether the picture is a fixed watermark or scrolls with the page
See also put_bgProperties
HRESULT put_leftMargin(
VARIANT v
);
Sets the left margin for the entire body of the page and overrides the default margin.
See also get_leftMargin
HRESULT get_leftMargin(
VARIANT *p
);
Retrieves the left margin for the entire body of the page. This property overrides the default margin.
See also put_leftMargin
HRESULT put_topMargin(
VARIANT v
);
Sets the margin for the top of the page and overrides the default margin.
See also get_topMargin
HRESULT get_topMargin(
VARIANT *p
);
Retrieves the margin for the top of the page and overrides the default margin.
See also put_topMargin
HRESULT put_rightMargin(
VARIANT v
);
Sets the right margin for the entire body of the page and overrides the default margin.
See also get_rightMargin
HRESULT get_rightMargin(
VARIANT *p
);
Retrieves the right margin for the entire body of the page and overrides the default margin.
See also put_rightMargin
HRESULT put_bottomMargin(
VARIANT v
);
Sets the margin for the bottom of the page and overrides the default margin.
See also get_bottomMargin
HRESULT get_bottomMargin(
VARIANT *p
);
Retrieves the margin for the bottom of the page and overrides the default margin.
See also put_bottomMargin
HRESULT put_noWrap(
VARIANT_BOOL v
);
Enables or disables automatic word wrapping for the document.
See also get_noWrap
HRESULT get_noWrap(
VARIANT_BOOL *p
);
Determines whether automatic word wrapping is enabled or disabled for the document.
See also put_noWrap
HRESULT put_bgColor(
VARIANT v
);
Sets the background color of the page.
JScript supports the entire set of valid property colors both as strings and their numerical equivalents as a string. JScript always returns the property as the numeric equivalent as a string regardless of the format to which the value was set.
See also get_bgColor
HRESULT get_bgColor(
VARIANT *p
);
Retrieves the background color of the page.
JScript supports the entire set of valid property colors both as strings and their numerical equivalents as a string. JScript always returns the property as the numeric equivalent as a string regardless of the format to which the value was set.
See also put_bgColor
HRESULT put_text(
VARIANT v
);
Sets the text (foreground) color for the document body.
The text is formatted within the current context of the document.
See also get_text
HRESULT get_text(
VARIANT *p
);
Retrieves the current text (foreground) color of the document body.
The text is formatted within the current context of the document.
See also put_text
HRESULT put_link(
VARIANT v
);
Sets the color of links that have not yet been visited.
See also get_link
HRESULT get_link(
VARIANT *p
);
Retrieves the color used for links that have not yet been visited.
See also put_link
HRESULT put_vLink(
VARIANT v
);
Sets the color of links that have been visited.
See also get_vLink
HRESULT get_vLink(
VARIANT *p
);
Retrieves the color used for links that have been visited.
See also put_vLink
HRESULT put_aLink(
VARIANT v
);
Sets the color for the active link.
See also get_aLink
HRESULT get_aLink(
VARIANT *p
);
Retrieves the color used for the active link.
See also put_aLink
HRESULT put_onload(
VARIANT v
);
Sets the inline script associated with the onload event on the BODY element. Occurs immediately after the browser loads the given object.
See also get_onload
HRESULT get_onload(
VARIANT *p
);
Retrieves the inline script associated with the onload event on the BODY element.
See also put_onload
HRESULT put_onunload(
VARIANT v
);
Sets the inline script associated with the onunload event on the BODY element.
See also get_onunload
HRESULT get_onunload(
VARIANT *p
);
Retrieves the inline script associated with the onunload event on the BODY element.
See also put_onunload
HRESULT put_scroll(
BSTR v
);
Turns the scroll bars on or off.
See also get_scroll
HRESULT get_scroll(
BSTR *p
);
Determines whether the scroll bars are on or off.
See also put_scroll
HRESULT put_onselect(
VARIANT v
);
Sets the inline script associated with the onselect event on the BODY element.
See also get_onselect
HRESULT get_onselect(
VARIANT *p
);
Retrieves the inline script associated with the onselect event on the BODY element.
See also put_onselect
HRESULT put_onbeforeunload(
VARIANT v
);
Sets the inline script associated with the onbeforeunload event on the BODY element.
The handler for this event should return NULL if doing the unload is safe, or a text string to prompt the user to decide to cancel or continue with the unload operation. Only the user's response to the warning can stop the new navigation causing the unload; the event handler itself cannot unilaterally block the operation. If the handler returns a non-NULL string, a modal dialog box appears that displays the explanatory string. The dialog box shows three buttons with the message for user action:
In the case of frames, the full sequence of onbeforeunload events is fired on each frame in the same order, depth-first, that onunload events are about to be fired. A dialog box is presented for each event handler that returns a non-NULL string. The first Cancel response stops the potential navigation, in which case no unload occurs. If there is no Cancel response, the unload proceeds and onunload events fire.
See also get_onbeforeunload
HRESULT get_onbeforeunload(
VARIANT *p
);
Retrieves the inline script associated with the onbeforeunload event on the BODY element.
The handler for this event should return NULL if doing the unload is safe, or a text string to prompt the user to decide to cancel or continue with the unload operation. Only the user's response to the warning can stop the new navigation causing the unload; the event handler itself cannot unilaterally block the operation. If the handler returns a non-NULL string, a modal dialog box appears that displays the explanatory string. The dialog box shows three buttons with the message for user action:
In the case of frames, the full sequence of onbeforeunload events is fired on each frame in the same order, depth-first, that onunload events are about to be fired. A dialog box is presented for each event handler that returns a non-NULL string. The first Cancel response stops the potential navigation, in which case no unload occurs. If there is no Cancel response, the unload proceeds and onunload events fire.
See also put_onbeforeunload
HRESULT createTextRange(
IHTMLTxtRange **range
);
Creates a text range object for the BODY object. You use a text range to examine and modify the text within the element.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.