Changes

Jump to: navigation, search

JavaScript Document Object

878 bytes added, 19:19, 14 May 2007
no edit summary
In the [[JavaScript Window Object]] chapter we looked at how perform such tasks as opening and closing browser windows and controlling the appearance and position of those windows. Whilst the window object gives us the ability to control various aspects of the browser window it does not provide us any control over the content of the window. In order to manipulate the content that appears in the browser we need to turn to the JavaScript ''Document'' object.
 
== What is the JavaScript Document Object? ==
 
The JavaScript Document object essentially contains the HTML elements that are contained the ''<head>'' and ''<body>'' sections of a web page. The Document object gets the initial value of its ''title'' property from the HTML ''<title>'' tag and a number of color and event values from the ''<body>'' element:
 
<pre>
 
<body
[alink="activated link color"]
[background="background image file"]
[bgcolor="background color"]
[link="unvisited link color"]
[onload="page load functionName"]
[onunload="page unload functionName"]
[text="foreground color"]
[vlink="visited link color"
</body>
 
</pre>
 
It is important to note that these are only optional initial values. Regardless of whether these are declared in the ''<body>'' element they can still be set, or modified from JavaScript via the Document object.

Navigation menu