IHTMLBodyElement

IHTMLBodyElement


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
put_background   get_background   put_bgProperties  
get_bgProperties   put_leftMargin   get_leftMargin  
put_topMargin   get_topMargin   put_rightMargin  
get_rightMargin   put_bottomMargin   get_bottomMargin  
put_noWrap   get_noWrap   put_bgColor  
get_bgColor   put_text   get_text  
put_link   get_link   put_vLink  
get_vLink   put_aLink   get_aLink  
put_onload   get_onload   put_onunload  
get_onunload   put_scroll   get_scroll  
put_onselect   get_onselect   put_onbeforeunload  
get_onbeforeunload   createTextRange  

IHTMLBodyElement::put_background

HRESULT put_background(
    BSTR v
);

Sets a background picture. The picture is tiled behind the text and graphics on the page.

v
String value specifying the URL of the background picture.

See also get_background

IHTMLBodyElement::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.

p
Address of a string variable that receives the URL of the background picture.

See also put_background

IHTMLBodyElement::put_bgProperties

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

v
String value specifying the background properties. If this parameter is "fixed", the background picture is fixed and does not scroll with the page. If set to an empty string (""), the background picture scrolls.

See also get_bgProperties

IHTMLBodyElement::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

v
Address of a string variable that receives the background properties. This parameter receives "fixed" if the background picture is fixed and does not scroll with the page, or an empty string ("") if the background picture scrolls.

See also put_bgProperties

IHTMLBodyElement::put_leftMargin

HRESULT put_leftMargin(
    VARIANT v
);

Sets the left margin for the entire body of the page and overrides the default margin.

v
VARIANT structure containing a string or value specifying the left margin. If set to "", the margin will be exactly on the left edge.

See also get_leftMargin

IHTMLBodyElement::get_leftMargin

HRESULT get_leftMargin(
    VARIANT *p
);

Retrieves the left margin for the entire body of the page. This property overrides the default margin.

p
Address of a VARIANT structure that receives the left margin. This property receives "" if the margin is exactly on the left edge.

See also put_leftMargin

IHTMLBodyElement::put_topMargin

HRESULT put_topMargin(
    VARIANT v
);

Sets the margin for the top of the page and overrides the default margin.

v
VARIANT structure that contains either a string or numeric value specifying the top margin. If set to "", the margin will be exactly on the top edge.

See also get_topMargin

IHTMLBodyElement::get_topMargin

HRESULT get_topMargin(
    VARIANT *p
);

Retrieves the margin for the top of the page and overrides the default margin.

p
Address of a VARIANT structure that receives the top margin. This property receives "" if the margin is exactly on the top edge.

See also put_topMargin

IHTMLBodyElement::put_rightMargin

HRESULT put_rightMargin(
    VARIANT v
);

Sets the right margin for the entire body of the page and overrides the default margin.

v
VARIANT structure containing a string or value specifying the right margin. If set to "", the margin will be exactly on the right edge.

See also get_rightMargin

IHTMLBodyElement::get_rightMargin

HRESULT get_rightMargin(
    VARIANT *p
);

Retrieves the right margin for the entire body of the page and overrides the default margin.

p
Address of a VARIANT structure that receives the right margin. This property receives "" if the margin is exactly on the right edge.

See also put_rightMargin

IHTMLBodyElement::put_bottomMargin

HRESULT put_bottomMargin(
    VARIANT v
);

Sets the margin for the bottom of the page and overrides the default margin.

v
VARIANT structure containing either a string or value specifying the bottom margin. If set to "", the margin will be exactly on the bottom edge.

See also get_bottomMargin

IHTMLBodyElement::get_bottomMargin

HRESULT get_bottomMargin(
    VARIANT *p
);

Retrieves the margin for the bottom of the page and overrides the default margin.

p
Address of a VARIANT structure that receives the bottom margin. This property receives "" if the margin is exactly on the bottom edge.

See also put_bottomMargin

IHTMLBodyElement::put_noWrap

HRESULT put_noWrap(
    VARIANT_BOOL v
);

Enables or disables automatic word wrapping for the document.

v
Boolean value that contains the word-wrap flag. If TRUE, the browser performs automatic word wrapping for the document. If FALSE, it doesn't. The default value for this property is FALSE.

See also get_noWrap

IHTMLBodyElement::get_noWrap

HRESULT get_noWrap(
    VARIANT_BOOL *p
);

Determines whether automatic word wrapping is enabled or disabled for the document.

p
Address of a Boolean variable that receives TRUE if automatic word-wrapping is enabled for the document, or FALSE otherwise. The default value for this property is FALSE.

See also put_noWrap

IHTMLBodyElement::put_bgColor

HRESULT put_bgColor(
    VARIANT v
);

Sets the background color of the page.

v
VARIANT structure containing a string or value specifying the color. The color can be one of the color names or values given in the Color Table reference documentation.

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

IHTMLBodyElement::get_bgColor

HRESULT get_bgColor(
    VARIANT *p
);

Retrieves the background color of the page.

p
Address of a VARIANT structure that receives the color. The color can be one of the color names or values given in the Color Table reference documentation.

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

IHTMLBodyElement::put_text

HRESULT put_text(
    VARIANT v
);

Sets the text (foreground) color for the document body.

v
VARIANT structure that contains either a string or value specifying the color. The color can be one of the color names or values given in the Color Table reference documentation.

The text is formatted within the current context of the document.

See also get_text

IHTMLBodyElement::get_text

HRESULT get_text(
    VARIANT *p
);

Retrieves the current text (foreground) color of the document body.

p
Address of a VARIANT structure that receives the color. The color can be one of the color names or values given in the Color Table reference documentation.

The text is formatted within the current context of the document.

See also put_text

IHTMLBodyElement::put_link

HRESULT put_link(
    VARIANT v
);

Sets the color of links that have not yet been visited.

v
VARIANT structure containing either a string or value specifying the color. Can be one of the color names or values given in the Color Table reference documentation.

See also get_link

IHTMLBodyElement::get_link

HRESULT get_link(
    VARIANT *p
);

Retrieves the color used for links that have not yet been visited.

p
Address of a VARIANT structure that receives the color. Can be one of the color names or values given in the Color Table reference documentation.

See also put_link

IHTMLBodyElement::put_vLink

HRESULT put_vLink(
    VARIANT v
);

Sets the color of links that have been visited.

v
VARIANT structure that contains either a string or value specifying the color. Can be one of the color names or values given in the Color Table reference documentation.

See also get_vLink

IHTMLBodyElement::get_vLink

HRESULT get_vLink(
    VARIANT *p
);

Retrieves the color used for links that have been visited.

p
Address of a VARIANT structure that receives the color. Can be one of the color names or values given in the Color Table reference documentation.

See also put_vLink

IHTMLBodyElement::put_aLink

HRESULT put_aLink(
    VARIANT v
);

Sets the color for the active link.

v
VARIANT structure containing either a string or value specifying the color. Can be one of the color names or values given in the Color Table reference documentation.

See also get_aLink

IHTMLBodyElement::get_aLink

HRESULT get_aLink(
    VARIANT *p
);

Retrieves the color used for the active link.

p
Address of a VARIANT structure that receives the color. Can be one of the color names or values given in the Color Table reference documentation.

See also put_aLink

IHTMLBodyElement::put_onload

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.

v
VARIANT structure that contains the script.

See also get_onload

IHTMLBodyElement::get_onload

HRESULT get_onload(
    VARIANT *p
);

Retrieves the inline script associated with the onload event on the BODY element.

p
Address of a VARIANT structure that will hold the script.

See also put_onload

IHTMLBodyElement::put_onunload

HRESULT put_onunload(
    VARIANT v
);

Sets the inline script associated with the onunload event on the BODY element.

v
VARIANT structure containing the script.

See also get_onunload

IHTMLBodyElement::get_onunload

HRESULT get_onunload(
    VARIANT *p
);

Retrieves the inline script associated with the onunload event on the BODY element.

p
Address of a VARIANT structure to store the script.

See also put_onunload

IHTMLBodyElement::put_scroll

HRESULT put_scroll(
    BSTR v
);

Turns the scroll bars on or off.

v
String value specifying whether to turn the scroll bars on or off. Specify "yes" to turn on the scroll bars, or "no" to turn them off.

See also get_scroll

IHTMLBodyElement::get_scroll

HRESULT get_scroll(
    BSTR *p
);

Determines whether the scroll bars are on or off.

p
Address of a string variable that receives "yes" if the scroll bars are on, or "no" if they are off.

See also put_scroll

IHTMLBodyElement::put_onselect

HRESULT put_onselect(
    VARIANT v
);

Sets the inline script associated with the onselect event on the BODY element.

v
VARIANT structure that contains the script.

See also get_onselect

IHTMLBodyElement::get_onselect

HRESULT get_onselect(
    VARIANT *p
);

Retrieves the inline script associated with the onselect event on the BODY element.

p
Address of a VARIANT structure to store the script.

See also put_onselect

IHTMLBodyElement::put_onbeforeunload

HRESULT put_onbeforeunload(
    VARIANT v
);

Sets the inline script associated with the onbeforeunload event on the BODY element.

v
VARIANT structure containing the script.

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

IHTMLBodyElement::get_onbeforeunload

HRESULT get_onbeforeunload(
    VARIANT *p
);

Retrieves the inline script associated with the onbeforeunload event on the BODY element.

p
Address of a VARIANT structure to store the script.

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

IHTMLBodyElement::createTextRange

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.

range
Address of a pointer to the IHTMLTxtRange interface that is created.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.