DOM Object:  HTMLDocument
 

Properties & Methods

Functional Description

Data

Test Case

title Read document.title from a title which contains text   hdoc001.html
title Read document.title.  Complex test.   hdoc002.html
title Read document.title from a title which contains no text between the TITLE tags    
title     hdoc003.html
title Read document.title from a title that doesn't exist (no TITLE tags)    
referrer Get the URI of the page that linked to this page.   hdoc004.html
referrer Navigate to test page directly (via a bookmark) then get the URI of the page that linked to this page. (The value should be an empty string.)   hdoc005.html
domain Get the domain name of the server that served the document. (test passing is dependent on what server it is run from)   hdoc006.html
domain Same as hdoc006.html as we are reading the name from the url and it considers anything before "/" as domain   hdoc007.html
URL Get the complete URI of the document. (test passing is dependent on what server it is run on)   hdoc008.html
body Get the BODY element from a document    hdoc009.html
body Get the BODY element from a frameset documents.  (Should return the outermost FRAMESET element.)   hdoc011.html
images Get the IMG elements from a document with 1 image test.gif hdoc012.html
images Get the IMG elements from a document with 0 images   hdoc013.html
images Get the IMG elements from a document with many  images test.gif , snowman.gif hdoc014.html
applets Get the OBJECT elements from a page with no APPLET objects or applet elements   hdoc015.htm l
applets Get the OBJECT elements from a page with 1 APPLET object   hdoc016.html
applets Get the OBJECT elements from a page with many APPLET objects and applet elements   hdoc017.html
links A collection of all AREA elements and anchor (A) elements in a document with a value for the href attribute.  stub.html, cbs.jpg hdoc018.html
forms Get the forms from a document with 1 form.   hdoc020.html
forms Get the forms from a document with many forms.   hdoc021.html
anchors A collection of all the anchor (A) elements in a document with a value for the name attribute. Note. For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute .   hdoc022.html
cookie Get the cookies associated with the document when there are no cookies. (The value should be an empty string.)
. If there are none, the value is an empty string. Otherwise, the value is a string: a semicolon-delimited list of "name, value" pairs for all the cookies associated with the page.
For example, name=value;expires=date. 
  hdoc023.htm l
cookie Get the cookies associated with the document when there is 1 cookie.    hdoc024.html
cookie Get the cookies associated with the document when there are many cookies.    hdoc025.html
open() Open a document stream for writing by clearing an existing document.   hdoc026.html
open() Open a new document stream for writing   hdoc027.html
write(text)

Parameters 
- text: The string to be parsed into some structure in the document structure model.
Read a string of text written with the write statement.   hdoc029.html
writeln(text)

Parameters 
- text: The string to be parsed into some structure in the document structure model.
Write a string of text followed by a newline character to a document stream opened by open().    hdoc030.htm l

getElementById(elementId)

(DOM2 inherited from Document)
Parameters 
- elementId: The unique id value for an element.

Return Value :   The matching element. 

Read the element ID of a document with one element using ID. test.gif hdoc031.html
getElementById(elementId)
(DOM2 inherited from Document)
Read the element IDs of a document with many different elements containing IDs. test.gif hdoc032.html
getElementById(elementId)
(DOM2 inherited from Document)
Read the element IDs of a document with many different elements containing IDs and at least 2 having the same ID.   hdoc033.html

getElementsByName(elementName) 

Parameters 
- elementName:  The name attribute value for an element.

Return Value: The matching elements. 

Returns the (possibly empty) collection of elements whose name value is given by elementName.    hdoc034.html