BODY XHTML Element

Send Feedback

The BODY element denotes the beginning and end of the document body. This is a block element and requires a closing tag.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties for All DOM Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events, methods and collections.

Attributes

Attribute Value PPC SP Description
ALINK Special Yes Yes This attribute indicates the color that a hyperlink assumes when it is activated or clicked on.
Note   Link colors are disabled on grayscale devices resulting in link colors always being black.

This attribute is equivalent to the CSS:

a:active { color: {color} };
BACKGROUND URL Yes Yes Specifies the URL of a background image to be tiled behind the images and text on a page.
Note   To improve readability, background images are disabled on grayscale devices and will not render.

This attribute is equivalent to the CSS:

background-image: url( {url} );
BGCOLOR Special Yes Yes Specifies the background color of the page. Values are specified in the format #RRGGBB where RR, GG and BB are hexadecimal values for red, green, and blue levels or can be specified by using one of the following color names listed below.

This attribute is equivalent to the CSS:

background-color: {color};
Note   Background colors on the body are disabled on grayscale devices. The page will always have a white background.

Color names:

  • aliceblue
  • antiquewhite
  • aqua
  • aquamarine
  • azure
  • beige
  • bisque
  • black
  • blanchedalmond
  • blue
  • blueviolet
  • brown
  • burlywood
  • cadetblue
  • chartreuse
  • chocolate
  • coral
  • cornflowerblue
  • cornsilk
  • crimson
  • cyan
  • darkblue
  • darkcyan
  • darkgoldenrod
  • darkgray
  • darkgreen
  • darkkhaki
  • darkmagenta
  • darkolivegreen
  • darkorange
  • darkorchidg
  • darkred
  • darksalmon
  • darkseagreen
  • darkslateblue
  • darkslategray
  • darkturquoise
  • darkviolet
  • deeppink
  • deepskyblue
  • dimgray
  • dodgerblue
  • firebrick
  • floralwhite
  • forestgreen
  • fuchsia
  • gainsboro
  • ghostwhite
  • gold
  • goldenrod
  • gray
  • green
  • greenyellow
  • honeydew
  • hotpink
  • indianred
  • indigo
  • ivory
  • khaki
  • lavender
  • lavenderblush
  • lawngreen
  • lemonchiffon
  • lightblue
  • lightcoral
  • lightcyan
  • lightgoldenrod-yellow
  • lightgreen
  • lightgrey
  • lightpink
  • lightsalmon
  • lightseagreen
  • lightskyblue
  • lightslategray
  • lightsteelblue
  • lightyellow
  • lime
  • limegreen
  • linen
  • magenta
  • maroon
  • medium-aquamarine
  • mediumblue
  • mediumorchid
  • mediumpurple
  • mediumseagreen
  • mediumslateblue
  • medium-springgreen
  • mediumturquoise
  • mediumvioletred
  • midnightblue
  • mintcream
  • mistyrose
  • moccasin
  • navajowhite
  • navy
  • oldlace
  • olive
  • olivedrab
  • orange
  • orangered
  • orchid
  • palegoldenrod
  • palegreen
  • paleturquoise
  • palevioletred
  • papayawhip
  • peachpuff
  • peru
  • pink
  • plum
  • powderblue
  • purple
  • red
  • rosybrown
  • royalblue
  • saddlebrown
  • salmon
  • sandybrown
  • seagreen
  • seashell
  • sienna
  • silver
  • skyblue
  • slateblue
  • slategray
  • snow
  • springgreen
  • steelblue
  • tan
  • teal
  • thistle
  • tomato
  • turquoise
  • violet
  • wheat
  • white
  • whitesmoke
  • yellow
  • yellowgreen
CLASS   Yes Yes  
ID   Yes Yes  
LEFTMARGIN 0...# Yes Yes Specifies the left margin of the body in pixels. Negative values are allowed. The default value is 6.

This attribute is equivalent to the CSS:

margin-left: {n};
LINK Special Yes Yes Specifies the color for links on a page. See BODY BGCOLOR for the format and possible color names.
Note   Link colors are disabled on grayscale devices resulting in link colors always being black.

This attribute is equivalent to the CSS:

a { color: {color} };
ONLOAD   Yes Yes  
ONULOAD   Yes Yes  
RIGHTMARGIN 0...# Yes Yes Specifies the right margin of the body in pixels. Negative values are not supported. The default value is 6.

This attribute is equivalent to the CSS:

margin-right: {n};
TEXT Special Yes Yes Specifies the color of the text on a page.

See BGCOLOR for the format and possible color names.

Text colors are disabled on grayscale devices resulting in text always being black.

This attribute is equivalent to the CSS:

color: {color};
STYLE   Yes Yes  
TOPMARGIN 0...# Yes Yes Specifies the top margin of the body in pixels. Negative values are not supported. The default value is 6.

This attribute is equivalent to the CSS:

margin-top: {n}; margin-bottom: {n};
VLINK Special Yes Yes This attribute indicates the default color of hyperlinks that have already been activated.

Link colors are disabled on grayscale devices resulting in link colors always being black.

This attribute is equivalent to the CSS:

a:visited { color: {color} };

Scripting Properties

This element has no scripting properties.

Scripting Methods

This property has no associated methods.

Scripting Collections

Collections Arguments Support Comments
all   Yes  
   length long read only  
   item ([optional] variant name,
[optional] variant index)
Yes  
anchors   Yes This collection contains an array of anchor objects in the document.
   length long read only  
   item ([optional] variant name,
[optional] variant index)
Yes  
forms object Yes Collection of all FORM objects in the document in source order.

syntax:

[colForms=]document.forms

[oObject=]document.forms(vIndex)

colElements

  • Collection of forms
  • oObject
  • Reference to an individual item in the array of elements contained by the object.
  • vIndex
  • Required. Integer that specifies the element or collection to retrieve.
    Note: the value of vIndex cannot be accesed as a string.
   length long read only Contains the number of form objects in the collection.

To find the number of elements in a particular form object, use: forms[index].elements.length, not forms[index].length.

   item ([optional] variant name,
[optional] variant index)
Yes  
frames object Yes  
   length long read only Always returns 0 on Smartphone
Note   Windows Mobile-based Smartphones do not support frames.
   item ([optional] variant name,
[optional] variant index)
Yes  
links object Yes Retrieves a collection all of the <A> (link) objects which have a HREF and all AREA objects in the document.
   length long Yes Contains the number of elements in the links collection.
   item ([optional] variant name,
[optional] variant index)
Yes  
images object Yes  
   length long read only  
   item ([optional] variant name,
[optional] variant index)
Yes  

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later

See Also

XHTML Elements

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.