HTML and CSS Reference
In-Depth Information
EXAMPLE 11.2
<html>
<head><title>Document Object Properties</title></head>
<body bgcolor="silver" text="forestgreen" link="blue"
vlink="purple">
<font face="arial" size="+2">
<script type="text/javascript">
var beg_tag="<em>"; end_tag="</em><br />";
document.write("The location of the document"+ beg_tag +
1
document.location + end_tag);
document.write("The document's title: "+ beg_tag+
2
document.title + end_tag);
document.write("The background color: "+ beg_tag+
3
document.bgColor + end_tag);
document.write("The link color is: "+ beg_tag+
4
document.linkColor + end_tag);
document.write("The text color is: "+ beg_tag+
5
document.fgColor + end_tag);
document.write("The document was last modified: "+ beg_tag +
6
document.lastModified + end_tag);
</script>
7
<a href="thanks2.html">Thanks!</a>
</font
</body>
</html>
EXPLANATION
1
This property contains the location of the document; that is, the full path name
to the document.
2
This property contains the title of the document, shown in the title bar at the top
of the window.
3
This property describes the hexadecimal color of the document's background, in
this example, silver.
4
This property describes the hexadecimal color of links, blue in this example.
5
This property describes the hexadecimal color of the text, forest green in this
example.
6
This displays the date and time when the document was last modified.
7
The link will change color from blue to purple once it has been visited. Complete
output is shown in Figure 11.3. Clicking this link opens another page called
“thanks2.html” displayed in Figure 11.4.
 
Search WWH ::




Custom Search