BODY XHTML Element
A version of this page is also available for
4/8/2010
The BODY element denotes the beginning and end of the document body. This is a block element and requires a closing tag. This is also the scripting object document.
Using this Element
There are some common properties and collections that apply to all the elements of the document object model, see Common Properties, Methods and Collections for the HTML 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
The following table shows items that Internet Explorer Mobile supports.
Attribute | Value | Description |
---|---|---|
ALINK |
Special |
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:
|
BACKGROUND |
URL |
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:
|
BGCOLOR |
Special |
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:
> [!NOTE]
> Background colors on the body are disabled on grayscale devices. The page will always have a white background.
Color names:
|
CLASS |
|
|
ID |
|
|
LEFTMARGIN |
0…# |
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:
|
LINK |
Special |
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:
|
ONLOAD |
|
|
ONULOAD |
|
|
RIGHTMARGIN |
0…# |
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:
|
TEXT |
Special |
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:
|
STYLE |
|
|
TOPMARGIN |
0…# |
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:
|
VLINK |
Special |
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:
|
Scripting Properties
Property | Type | Access | Comments |
---|---|---|---|
alinkColor |
variant |
Read/Write |
Sets or retrieves the active link color in the specified document. |
bgColor |
variant |
Read/Write |
Sets or retrieves the background color of the specified document. See BGCOLOR property for the format and possible color names. > [!NOTE] > The color values returned by the browser are not prefixed with a ‘#’. |
body |
object |
Read/Write |
Sets or retrieves the body or frameset object that is the node of the current document object. |
cookie |
string |
Read/Write |
Sets or retrieves the string value of a cookie. sCookie is the string that specifies or receives the name=value pairs, plus any of the following values:
|
documentElement |
Object |
Read |
Retrieves a reference to the root node of the document. |
domain |
string |
Read/Write |
Sets or retrieves the domain the document is on, which is initially set to the host that the document is on (like www.southridgevideo.com). |
fgColor |
variant |
Read/Write |
Sets or retrieves the foreground (text) color of the document. See BGCOLOR property for the format and possible color names. |
lastModified |
string |
Read |
Contains the time and date the document was last modified |
linkColor |
variant |
Read/Write |
Sets or retrieves the color of the links in the document. See BGCOLOR property for the format and possible color names. |
location |
string |
Read/Write |
Sets or retrieves the current URL of the document. It is also an object that represents information about the current document. See location object for more details. |
parentWindow |
object |
Read |
|
referrer |
string |
Read |
Contains the URL of the document where the current document was linked from. > [!NOTE] > This property will always return an empty string. |
title |
string |
Read/Write |
Contains the TITLE of the document. |
URL |
string |
Read |
Contains the URL of the current document. |
vlinkColor |
variant |
Read/Write |
Sets or retrieves the color of visited links in the specified document. See BGCOLOR property for the format and possible color names. |
Scripting Events
The following table shows items that Internet Explorer Mobile supports.
Event | Comment |
---|---|
onload |
This event fires right after the page is loaded |
onunload |
This event fires right before the current page is unloaded (for example, if the user navigates away from the page or refreshes the page) |
Scripting Methods
The following table shows items that Internet Explorer Mobile supports.
Method | Arguments | Comments |
---|---|---|
clear |
|
Syntax:
|
close |
|
Syntax:
|
createElement |
String |
Syntax:
|
getElementById |
|
Syntax:
|
getElementsByTagName |
|
Syntax:
|
open |
([optional] string MIME-Type, [optional] variant replace) |
Syntax:
|
write |
array |
Syntax:
|
writeln |
array |
Syntax:
|
Scripting Collections
The following table shows items that Internet Explorer Mobile supports.
Collections | Arguments | Support | Comments |
---|---|---|---|
all |
|
Yes |
|
length |
long |
Read |
|
item |
([optional] variant name, [optional] variant index) |
Yes |
|
anchors |
|
Yes |
This collection contains an array of anchor objects in the document. |
length |
long |
Read |
|
item |
([optional] variant name, [optional] variant index) |
Yes |
|
length |
|
Yes |
Always returns 0 |
forms |
object |
Yes |
Collection of all FORM objects in the document in source order. syntax:
|
length |
long |
Read |
Contains the number of form objects in the collection. To find the number of elements in a particular form object, use: |
item |
([optional] variant name, [optional] variant index) |
Yes |
|
frames |
object |
Yes |
|
length |
long |
Read |
Always returns 0 on Windows Mobile Standard |
item |
([optional] variant name, [optional] variant index) |
Yes |
|
images |
object |
Yes |
|
length |
long |
Read |
|
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 |
|
Requirements
Windows Mobile | Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later |