HTML and CSS Reference
In-Depth Information
A new array object called props is created with the Array() constructor.
The for/in loop allows you to enumerate (list one by one) the properties of an ob-
ject, in this case the document object. The body of the for/in loop is executed once
for each property of the document object.
Each time through the loop, a new property of the document object is pushed onto
the props array.
This for loop iterates through the props array to list the properties that were as-
signed to it.
Each property of the document object is displayed in groups of three. The output
differs somewhat on different browsers.
Figure 11.2 Partial output showing the document's properties.
Using the document Object Properties in JavaScript. Example 11.2 demon-
strates how the properties that describe the document are used in a JavaScript program.
The write() method displays a description of each of these properties as they pertain to
the current document. The background color is silver, the text is forest green, the unvis-
ited link is blue, and the visited link is purple.
Search WWH ::

Custom Search