CSGNetwork FREE Source Code, Javascript Source, and Code Snippets!
CSGNetwork Custom Search
     Bookmark and Share
Top Free Apps

Right click this window and select "view source" in order to copy the source for this script.

Document Object

Document is the parent object of numerous other objects, such as "images", "forms" etc.


Properties Description
alinkColor Specifies the color of activated links in the document (Alink attribute).
all[] IE4+ exclusive array that contains all of the elements within the document. Use document.all["elementID"] or document.all.elementID to access an element.
anchors[] An array containing all of the anchors in the document.
applets[] An array containing all of the applets in the document.
bgColor Specifies the background color of the document.
cookie A string containing the name/value pair of cookies in the document.
domain Specifies the domain name of the server that served a document. Used for security purposes.
embeds[] An array containing all of the plug-ins in the document, represented using the <embed> tag.
fgColor Specifies the default text color of the document (text attribute).
fileSize Returns the file size of the current document. In IE Windows, a numeric string is returned, while in IE Mac, a number instead. IE only property.
forms[] An array containing all of the forms on the page.
images[] An array containing all of the images on the page.
lastModified Specifies the last modified date of the document, as reported by the web server.
linkColor Specifies the color of unvisited links in the document (link attribute).
links[] An array containing all of the links on the page.
plugins[] Same as embeds[] object.
readyState IE4+ exclusive property that specifies the loading status of the document. It returns one of the below 4 values:
1) uninitialized- The document hasn't started loading yet.
2) loading- The document is loading.
3) interactive- The document has loaded enough whereby user can interact with it.
4) complete- The document has fully loaded.
referrer A string that specifies the URL in which the user derived from to reach the current, usually via a link.
title Specifies the title of the document. Read/write in modern browsers.
URL A string that specifies the complete URL of the document.
vlinkColor Specifies the color of visited links in the document (vlink attribute).


Note: "[]" surrounding a parameter below means the parameter is optional.

Methods Description
close() Closes a document stream opened using
getElementById("ID") A cross browser (IE5/NS6+) DOM method for accessing any element on the page via its ID attribute.
open([mineType]) Opens a document stream in preparation for document.write() to write to it. Use the optional "mineType" argument (default is text/html) to specify a specific minetype, such as "image/gif." Example(s).
write("string") Writes to the document (as it's loading) or document stream the "string" entered. Example(s).
writeln("string") Writes to the document (as it's loading) or document stream the "string" entered and inserts a newline character at the end.



This example opens a blank window and writes to it:"") //open blank window and write to it //open document stream
win2.document.write("<b>Some text</b>")


Writes out the current document's URL while the page is loaded:

document.write("This page\'s URL is "+document.URL)

Bookmark and Share
Registered® Trademark™ and Copyright© 1973 - CSG, Computer Support Group, Inc. and CSGNetwork.Com All Rights Reserved