Develop a new think
document.property
Property Description
bgColor The color of the document background (read/write).

fgColor The color of the document foreground text (read/write).

title The title appearing in the <title> tag of the current document (read-only).

referrer The URL of the document from which the user linked to the current document by clicking an <a> link (read-only).

lastModified The date on which the current document was last changed (read-only).

linkColor The color of text for a link that the user has not yet visited (read/write).

vlinkColor The color of text for a link that the user has already visited (read/write).

alinkColor The color of text for a link that the user clicks (read/write).



Background Color:
Red Green Blue Black White

Foreground Color:
Red Green Blue Black White
<script type="text/javascript">

function ChangeBackground(Color)
{
  document.bgColor = Color;
  // style sheet equivalent: document.body.style.backgroundColor = Color
}

function ChangeForeground(Color)
{
  document.fgColor = Color;
  // style sheet equivalent: document.body.style.color = Color
}

</script>

<b>Background Color:</b><br/>
<input type="radio" name="BG" onclick="ChangeBackground('red')"/>Red
<input type="radio" name="BG" onclick="ChangeBackground('green')"/>Green
<input type="radio" name="BG" onclick="ChangeBackground('blue')"/>Blue
<input type="radio" name="BG" onclick="ChangeBackground('black')"/>Black
<input type="radio" name="BG" onclick="ChangeBackground('white')"/>White
<br/><br/>
<b>Foreground Color:</b><br/>
<input type="radio" name="FG" onclick="ChangeForeground('red')"/>Red
<input type="radio" name="FG" onclick="ChangeForeground('green')"/>Green
<input type="radio" name="FG" onclick="ChangeForeground('blue')"/>Blue
<input type="radio" name="FG" onclick="ChangeForeground('black')"/>Black
<input type="radio" name="FG" onclick="ChangeForeground('white')"/>White


Document Body Properties

There are certain properties of the document occupying the browser window that are accessible through the document's body object. These references are are in the following format.
document.body.property
Property Description
background The URL of the background image for the document, if any (read/write). CSS equivalent: background-image(url).

bgProperties� Indicates whether the background image for the document is fixed or scrolls with the page content (read/write). A scrolling background image is the default and is set by an empty string. CSS equivalent: background-attachment(fixed|scroll).

topMargin The number of pixels of white space at the top of the document (read-only). CSS equivalent: margin-top:npx (read/write).

rightMargin The number of pixels of white space on the right of the document (read-only). CSS equivalent: margin-right:npx (read/write).

bottomMargin The number of pixels of white space at the bottom of the document (read-only). CSS equivalent: margin-bottom:npx (read/write).

leftMargin The number of pixels of white space on the left of the document (read-only). CSS equivalent: margin-left:npx (read/write).

innerText The text (but not the XHTML) on the page (read/write). CSS equivalent: same.

innerHTML The text, including the XHTML, on the page (read/write). CSS equivalent: same.

clientWidth The width in pixels of the viewable area of the document (read-only).

clientHeight The height in pixels of the viewable area of the document (read-only).

scrollWidth The width in pixels of the scrollable area of the document. Same as clientWidth if no horizontal scroll bar is present (read-only).

scrollHeight The height in pixels of the scrollable area of the document. The full height of the document within the window (read-only).

scrollLeft The number of pixels by which the document is scrolled horizontally to the left (read/write).

scrollTop The number of pixels by which the document is scrolled vertically from the top of the document (read/write).


web counter