Page 137 - DCAP202_Fundamentals of Web Programming
P. 137
Fundamentals of Web Programming
Notes 10.5 Document Object
The JavaScript Document object is the container for all HTML HEAD and BODY objects associated
within the HTML tags of an HTML document.
10.5.1 Document Object – Properties
Document object has the following properties:
alinkColor - The color of active links.
bgColor - Sets the background color of the web page. It is set in the <body> tag. The
following code sets the background color to white.
document.bgColor = “#FFFFFF”
cookie - Used to identify the value of a cookie.
defaultCharset
domain - The domain name of the document server.
embeds - An array containing all the plugins in a document.
fgColor - The text color attribute set in the <body> tag.
FileCreatedDate - Use this value to show when the loaded HTML file was created.
fileModifiedDate - Use this value to show the last change date of the loaded HTML file
fileSize
fileUpdatedDate
lastModified - The date the file was modified last.
layers - An array containing all the layers in a document.
linkColor - The color of HTML links in the document. It is specified in the <body> tag.
location
mimeType
nameProp
protocol
readyState
referrer - The Universal Resource Locator (URL) of the document that we got the link to the
present document from.
security
title - The name of the current document as described between the header TITLE tags.
URL - The location of the current document.
vlinkColor - The color of visited links as specified in the <body> tag/
10.5.2 Document Object – Methods
The following methods are used in document object:
clear() - This is depreciated.
close() - Closes an output stream that was used to create a document object.
contextual() - It can be used to specify stype of specific tags.
130 LOVELY PROFESSIONAL UNIVERSITY