Change Language


Follow Navioo On Twitter

HTMLDocument : Document

HTML Document object.

Platform Support

IE Mozilla Netscape Opera Safari
3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
HTMLDocument Constructor() : HTMLDocument
HTML Document object.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

HTMLDocument() : HTMLDocument

HTML Document object.

Returns

HTMLDocument
Visibility
internal

Inherited Properties

Property Action IE Mozilla Netscape Opera Safari
activeElement : Element
Reference to the Element that currently has focus.
No Details 4.0+ no no no no
alinkColor : String
Specifies the color of active links.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Use the alink property of the tag to initially set the color of active links. To set this property, use the color properties of HTMLBodyElement to set the color in the tag.
See Also

HTMLBodyElement

Availability

HTML DOM Level 0

anchors : Array
Array of all of the Anchor objects in a document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Because the Anchors array is read-only, modify the array by adding and deleting anchor elements. Do not confuse Anchors with hypertext links.
Availability

HTML DOM Level 1

applets : Array
Array of all of the Applet objects in a document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Remarks
Because the Applets array is read-only, modify the array by adding and deleting applet elements.
Availability

HTML DOM Level 1

bgColor : String
Background color of a document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Use the bgColor property of the tag to set the document background color. To set this bgColor, use the color properties of HTMLBodyElement to set the color at any time.
See Also

HTMLBodyElement

Availability

HTML DOM Level 1

body : Element
Reference to the body or frameset element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Document_290.dhtml

Remarks

For additional compatibility information, see the quirksmode page:

http://www.navioo.com/javascript/tutorials/Source_File_5.htm

Availability

HTML DOM Level 1

charset : String
Character set of the document.
No Details 4.0+ no no no no
characterSet : String
Character set of the document.
No Details no 1.0+ 6.0+ no 1.0+
classes : Array
Array of style properties for CSS classes.
No Details no no 4.0+ no no
compatMode : Boolean
Indicates whether the document has standards-compliant mode turned on.
Show Details 6.0+ 1.75+ 7.0+ no no

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Source_File_5.htm

cookie : String
Value of the cookie that the browser has set for the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 1

defaultCharset : String
Default character set for the document.
No Details 4.0+ no no no no
designMode : String
Specifies that design mode for an HTML document is "on" or "off."
Show Details 5.0+ 1.4+ 7.0+ no no
Remarks
If design mode is on, a user can double-click the document to edit its HTML.
dir : String
Text direction of the content in the document.
Show Details 5.0+ 1.0+ 6.0+ no no

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/HTML_Tags_371.dhtml

Availability

HTML DOM Level 0

doctype : DocumentType
Document Data Type (DTD) associated with this document.
Show Details 6.0+ 1.0+ 6.0+ 7.0+ no
Remarks
Every document can contain a Document Type Declaration (DTD) that defines document structure and entity references for the document. The doctype property represents the state of this document's DTD, which is either a DocumentType object, or null, if no DTD is specified.
Availability

HTML DOM Level 2|W3C

documentElement : Element
Root element in a document.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Document_290.dhtml

Remarks

documentElement is a convenience property for accessing the contents of a document.

Without the

documentElement property, you would have to write doc.childNodes.item(0) or doc.childNodes[0] to access the contents of a document, instead of just typing doc.documentElement.

Availability

HTML DOM Level 2|W3C

domain : String
Internet domain of the document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Availability

HTML DOM Level 1

embeds : Array
Array of all embedded objects in the document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Remarks
embeds is a read-only property. You can add, delete, or modify the individual objects in the array, but you cannot modify the array itself.
See Also

Document.plugins

expando : Boolean
Indicates whether a client-side object may have instance properties added to it.
Show Details 4.0+ no no no no
Remarks
Use expando to help catch typos and case-sensitivity issues in your JavaScript.
fgColor : String
Font color of the document text.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Use the fgColor property of the <body> tag to initially set the color of the document text. To set this property, use the color properties of HTMLBodyElement to set the color in the <head> tag.
See Also

HTMLBodyElement

Availability

HTML DOM Level 0

fileCreatedDate : String
Date that the document was created.
No Details 4.0+ no no no no
fileModifiedDate : String
Date that the document was last modified.
No Details 4.0+ no no no no
fileSize : Number
File size (in bytes) of the document.
No Details 4.0+ no no no no
forms : Array
Array of all of the Forms in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Although the Forms array is read-only, you can modify the individual Form elements.
Availability

HTML DOM Level 1

frames : Array
Array of all of the Frames in the document.
Show Details 4.0+ no no no no
Remarks
Although the Frames array is read-only, you can modify the individual Frame elements.
height : Number
Height of the entire HTML document (in pixels).
No Details no 1.0+ 4.0+ 7.0+ 1.0+
ids : Array
Array of style properties in the document set by the Id attribute.
Show Details no no 4.0+ no no
Remarks
Although the Ids array is read-only, you can modify the individual Id elements.
images : Array
Array of Image objects in the document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Remarks
Although the Images array is read-only, you can modify the individual Image elements.
Availability

HTML DOM Level 1

implementation : Object
Object that specifies whether or not and at what level the browser supports the specified feature.
Show Details 6.0+ 1.0+ 6.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

lastModified : String
Date that the document was last modified.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 0

layers : Array
Array of all of the Layer elements in the document.
Show Details no no 4.0+ no no
Remarks
Includes divs positioned by CSS.
linkColor : String
Color of the unvisited links in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
See Also

HTMLBodyElement

Availability

HTML DOM Level 0

links : Array
Array of all of the links in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Although the Link array is read-only, you can modify the individual Link elements.
Availability

HTML DOM Level 1

location : Object
Complete URL of the document.
Show Details 3.0+ no 3-4 no no
Remarks
Deprecated for Window.location.
See Also

Window.location

media : String
The media that the document is intended for.
No Details 5.5+ no no no no
mimeType : String
Information about the document MIME type.
No Details 5.0+ no no no no
namespaces : Array
Array of the XML Namespaces for a document.
No Details 5.5+ no no no no
onactivate : Function
Fires when the element becomes active.
No Details 4.0+ no no no no
onbeforecut : Function
Fires immediately before the selection is cut to the clipboard.
No Details 4.0+ no no no 1.0+
onbeforedeactivate : Function
Fires immediately before the element stops being the active element.
No Details 4.0+ no no no no
onbeforeeditfocus : Function
Fires immediately before the element receives focus prior to being edited.
No Details 4.0+ no no no no
onbeforepaste : Function
Fires immediately before the selection is pasted from the clipboard to the element.
No Details 4.0+ no no no 1.0+
onclick : Function
Fires when the element is clicked.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
oncontextmenu : Function
Fires when the element is right-clicked and the context menu opens.
No Details 4.0+ no no no 1.0+
oncontrolselect : Function
Fires immediately before the element is selected.
No Details 4.0+ no no no no
oncut : Function
Fires when the element is cut to the clipboard.
No Details 4.0+ no no no 1.0+
ondblclick : Function
Fires when the element is double-clicked.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
ondrag : Function
Fires when the element is dragged.
No Details 4.0+ no no no 1.0+
ondragend : Function
Fires when the element is released from being dragged.
No Details 4.0+ no no no 1.0+
ondragenter : Function
Fires when the element has another object dragged onto it that can be dropped on the element.
No Details 4.0+ no no no 1.0+
ondragleave : Function
Fires when an element has an object dragged out of it that could be dropped onto the element.
No Details 4.0+ no no no 1.0+
ondragover : Function
Fires when an element has an object dragged over it that could be dropped onto the element.
No Details 4.0+ no no no 1.0+
ondragstart : Function
Fires immediately before an element is dragged.
No Details 4.0+ no no no 1.0+
ondrop : Function
Fires when an object is dropped onto the element.
No Details 4.0+ no no no 1.0+
onhelp : Function
Fires when a user presses the F1 key to activate help.
No Details 4.0+ no no no no
onkeydown : Function
Fires when a user presses down on a key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onkeypress : Function
Fires when a user presses a key or holds down the key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onkeyup : Function
Fires when a user releases a key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmousedown : Function
Fires when a user clicks down on the mouse button while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmousemove : Function
Fires when the mouse moves while the pointer over the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseout : Function
Fires when the mouse pointer moves off of the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseover : Function
Fires when the mouse pointer moves over the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseup : Function
Fires when the user releases the mouse button while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onpaste : Function
Fires when the clipboard contents are pasted onto the element.
No Details 4.0+ no no no 1.0+
onpropertychange : Function
Fires when one of the properties of the element changes.
No Details 4.0+ no no no no
onreadystatechange : Function
Fires when the ready state of the element changes.
No Details 4.0+ no no no no
onresize : Function
Fires immediately before an element is about to be resized.
No Details 4.0+ no no no 1.0+
onresizeend : Function
Fires when the element is finished being resized.
No Details 4.0+ no no no no
onresizestart : Function
Fires immediately before a user resizes the element.
No Details 4.0+ no no no no
onselectionchange : Function
Fires when the selected state of the document changes.
No Details 5.5+ no no no no
onstop : Function
Fires when a user clicks the Stop button on the browser.
No Details 5.5+ no no no no
parentWindow : Object
Reference to the parent Window of the document.
Show Details 4.0+ no no 8.0+ no

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Window_353.dhtml

See Also

Window

plugins : Array
Array of plugins installed in the browser.
Show Details 2.0+ 1.0+ 1.0+ 7.0+ 1.0+
Remarks
Synonym for the embeds[] array.
See Also

Document.embeds

protocol : String
Full name of the protocol (not "http") used to retrieve the document.
Show Details 4.0+ no no no no
Remarks
IE only. Supported in IE4+.
referrer : String
URL of the referring document.
Show Details 2.0+ 1.0+ 1.0+ 7.0+ 1.0+
Remarks
If a user reaches the current document by clicking a link in another document, the referrer property holds the URL for the document with the link. If the user typed the URL into the address bar, the referrer property is an empty string.
Availability

HTML DOM Level 1

scripts : Array
Array of all of the Scripts in the document.
No Details 4.0+ no no no no
security : String
Information about the security certificate for the document.
No Details 5.5+ no no no no
selection : Object
Object representing any currently selected text.
No Details 4.0+ no no no no
styleSheets : Array
Array of all of the styleSheets in the document.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.2+
  • Safari: Cannot access disabled or alternate stylesheets.

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Availability

HTML DOM Level 2

tags : Array
Array of style properties for certain HTML tags.
No Details no no 4.0+ no no
title : String
Title of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/innerHTML_Example_4506.html

Remarks
The title is the text that appears between the title tags of an HTML document.
Availability

HTML DOM Level 1

URL : String
URL of the document.
Show Details 4.0+ 1.0+ 2.0+ no no
See Also

location.href

URLUnencoded : String
URL-unencoded version of the URL.
Show Details 5.5+ no no no no
See Also

Document.URL

vlinkColor : String
Color of visited links.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Remarks
Use the vlink property of the tag to initially set the color of visted links. To set this property, use the color properties of HTMLBodyElement to set the color in the tag.
See Also

HTMLBodyElement

Availability

HTML DOM Level 0

width : Number
Width of the HTML document (in pixels).
No Details no 1.0+ 4.0+ 7.0+ 1.0+
XMLDocument : Object
Reference to the top-level node of the XML DOM used by the document.
No Details 5.0+ no no no no
XSLDocument : Object
Reference to the XSL document for the document.
No Details 5.0+ no no no no

Properties

Property Action IE Mozilla Netscape Opera Safari
anchors : HTMLCollection
Array of all of the anchors in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

applets : HTMLCollection
Array of all of the applets in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

body : HTMLElement
Reference to the HTMLBodyElement for the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Document_290.dhtml

Availability

HTML DOM Level 2|W3C

cookie : String
Cookies for the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

domain : String
Name of the domain that the document was loaded from.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

forms : HTMLCollection
Array of all of the forms (HTMLFormElement) in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

images : HTMLCollection
Array of all of the images in the document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

links : HTMLCollection
Array of all of the links in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

referrer : String
URL of the document that linked to this document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

title : String
Title of the document. (Contents of the title tag.)
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/innerHTML_Example_4506.html

Availability

HTML DOM Level 2|W3C

URL : String
URL of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

Inherited Functions

Method Action IE Mozilla Netscape Opera Safari
captureEvents(Number eventMask) : void
Sets an document to capture the events specified by eventMask.
Show Details no no 4.0+ no no

Parameters

Number eventMask Bitmask containing the events to capture.

Returns

void
Remarks
Supported in Mozilla and NS4+.
See Also

releaseEvents

clear() : void
Clears the content from the document.
Show Details 3.0+ 1.0+ 2.0+ no 1.0+

Returns

void
close() : Object
Stops the output stream to the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns

Object
Availability

HTML DOM Level 0

contextual(String context) : void
Sets a concept to select tags to style.
Show Details no no 4.0 no no

Parameters

String context (one-or-more)Name of the context to be used.

Returns

void
createCDATASection(Object data) : CDATASection
Creates a new CDATASection node
Show Details no 1.0+ no no no

Parameters

Object data The text to wrap up into a new CDATASection object.

Returns

CDATASection

Using createCDATASection

var cdata = document.createCDATASection(
                        'this &p invalid markup &exists in this CDATA & section'
                        );
                        var obj = document.getElementById('header');
                        obj.appendChild(cdata);
Remarks
Creates a new CDATASection object within the current document, representing a region of uninterpreted content. Any text within this object, with the exception of the string "]]>", will not be encoded or otherwise interpreted by the DOM engine.
Throws
Raises a NOT_SUPPORTED_ERR error if the current document is an HTML document.
Availability

HTML DOM Level 2|W3C

createComment(String data) : Comment
Creates a new Comment node
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String data The text to include in the comment.

Returns

Comment

Using createComment

var comment = document.createComment('this text will not appear in HTML');
                        var obj = document.getElementById('header');
                        obj.appendChild(comment);
Remarks
Creates a new Comment object that can be used for adding a region of commented text for inclusion into the current document. Any text within this object, with the exception of the string "-->" will be protected within the document.
Availability

HTML DOM Level 2|W3C

createDocumentFragment() : DocumentFragment
Creates an empty DocumentFragment object
Show Details 6.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns

DocumentFragment

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/createDocumentFragment_Example_4479.html

Availability

HTML DOM Level 2|W3C

createProcessingInstruction(String target, String data) : ProcessingInstruction
Creates a new ProcessingInstruction node with the specified target and data strings.
Show Details no 1.0+ no no no

Parameters

String target Name, or "target", of the processing instruction to create.
String data Data to store in the processing instruction.

Returns

ProcessingInstruction

Using createProcessingInstruction

document.createProcessingInstruction(
                        'xml-stylesheet',
                        'href="docbook.xsl" type="text/xsl"'
                        );
Remarks
Creates a new ProcessingInstruction at the beginning of the current document using the specified target and data values.
Throws
Raises an INVALID_CHARACTER_ERR error if the specified target contains illegal characers.
Raises a NOT_SUPPORTED_ERR error if the current document is an HTML document.
See Also

ProcessingInstruction

Availability

HTML DOM Level 2|W3C

elementFromPoint(Number x, Number y) : HTMLElement
Returns the element found at the specified x, y location in the document.
Show Details 4.0+ no no no no

Parameters

Number x Horizontal (x) position (in pixels) of the element to return.
Number y Vertical (x) position (in pixels) of the element to return.

Returns

HTMLElement
Remarks
IE only. Supported in IE4+.
getSelection() : String
Returns the text currently selected by the user.
Show Details no no 4.0+ no no

Returns

String
Remarks
Netscape only. Supported in NS4+.
isSupported(String feature, [String version]) : Boolean
Returns true if the specified feature and version are supported.
Show Details no 1.0+ 6.0+ no no

Parameters

String feature Name of the feature.
String version (optional)Version of the feature.

Returns

Boolean
Remarks
Tests whether a node supports the specified feature. Similar to the DOMImplementation.hasFeature method and takes the same feature names. If version is null, returns true if any version of the feature is supported.
See Also

DOMImplementation.hasFeature

Availability

HTML DOM Level 2

open([String mimeType,] [String name,] [String features,] [Boolean replace]) : void
Opens the document for writing.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String mimeType (optional)MIME Type for the new document. IE only.
String name (optional)Specifies the new name for the document. Always use with mimeType. IE only.
String features (optional)Specifies any window-like features the document should have. Always use with mimeType. IE only.
Boolean replace (optional)If true, specifies that the new document should replace the current document in the browser history. Always use with mimeType. IE only.

Returns

void
Remarks
Only use the parameters mimeType, name, features, and replace with IE. If you use any of the parameters, mimeType becomes a required parameter. If you are not coding strictly for IE, do not pass any parameters to the open method.
Availability

HTML DOM Level 1

queryCommandEnabled(String command) : Boolean
Returns true if the specified command is enabled.
Show Details 4.0+ 1.4+ 7.1+ no no

Parameters

String command Command to check.

Returns

Boolean
See Also

queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue

quertyCommandIndeterm(String command) : Boolean
Returns true if the specified command is in an indeterminate state.
Show Details 4.0+ 1.4+ 7.1+ no no

Parameters

String command Command to check.

Returns

Boolean
See Also

queryCommandEnabled|queryCommandState|queryCommandSupported|queryCommandValue

queryCommandState(String command) : Boolean
Returns true if the specified command has been executed on the object.
Show Details 4.0+ 1.4+ 7.1+ no no

Parameters

String command Command to check.

Returns

Boolean
See Also

queryCommandEnabled|queryCommandIndeterm|queryCommandSupported|queryCommandValue

queryCommandSupported(String command) : Boolean
Returns true if the specified command is supported.
Show Details 4.0+ 1.4+ 7.1+ no no

Parameters

String command Command to check.

Returns

Boolean
See Also

queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandValue

queryCommandValue(String command) : Object
Returns the value of the specified command for the document. Returns false if the command is not supported.
Show Details 4.0+ 1.4+ 7.1+ no no

Parameters

String command Command to check.

Returns

Object
See Also

queryCommandEnabled|queryCommandIndeterm|queryCommandState|queryCommandSupported

recalc([Boolean forceAll]) : void
Reevaluates all dynamic properties in the document.
Show Details 5.0+ no no no no

Parameters

Boolean forceAll (optional)If true, forces all dynamic properties in the document to be reevaluated. If false (default), reevaluates only the dynamic properties that have changed.

Returns

void
releaseEvents(Number eventMask) : Object
Sets the document to stop capturing the specified type of events.
Show Details no no 4.0+ no no

Parameters

Number eventMask Bitmask containing the events to stop capturing.

Returns

Object
Remarks
Netscape only. Supported in NS4+.
See Also

captureEvents

routeEvent(Object event) : Object
Routes the specified event to the next event handler.
Show Details no no 4.0+ no no

Parameters

Object event Instance of the event to route.

Returns

Object
Remarks
Netscape only. Supported in NS4+.
See Also

captureEvents|releaseEvents

selection() : Object
Gives information about the currently selected objects in the document.
Show Details 4.0+ no no no no

Returns

Object
Remarks
IE only. Supported in IE4+.
write(String string) : Object
Writes the specified string of text to the end of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String string (one-or-more)Text to append to the document.

Returns

Object

Using write

 document.write("Today's date is " + new Date()); 
See Also

writeln

Availability

HTML DOM Level 1|W3C

writeln(String string) : Object
Writes the specified string of text to the end of the document and adds a newline character at the end of the text.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String string (one-or-more)Text to append to the document.

Returns

Object

Using write

 document.writeln("Today's date is " + new Date()); 
See Also

write

Availability

HTML DOM Level 1|W3C

Functions

Method Action IE Mozilla Netscape Opera Safari
close() : void
Closes the output stream to the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns

void
See Also

HTMLDocument.open|Document.close

Availability

HTML DOM Level 2|W3C

static getElementsByName(String elementName) : NodeList
Returns an array of all of the elements in the document with the specified name.
Show Details 5.0+ 1.0+ 2.0+ 7.0+ 1.0+
  • IE: Only returns matching img and input elements.
  • Opera: Only returns matching img and input elements.

Parameters

String elementName Name of the element.

Returns

NodeList

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/tutorials/Get_Elements_by_tag_name_and_return_an_array_of_elements_1226.html

See Also

Document.getElementById|Document.getElementsByTagName

Availability

HTML DOM Level 2|W3C

open() : void
Opens an output stream for the document so that the document may be written to.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns

void
See Also

HTMLDocument.close|HTMLDocument.write|Document.open

Availability

HTML DOM Level 2|W3C

write(String text) : void
Appends a line of text to the end of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String text Text string to write.

Returns

void
See Also

HTMLDocument.open|Document.write

Availability

HTML DOM Level 2|W3C

writeln(String text) : void
Appends a line of text, followed by a newline character, to the end of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters

String text Text string to write.

Returns

void
See Also

Document.writeln

Availability

HTML DOM Level 2|W3C

References

Document.getElementById|HTMLBodyElement|Document

Availability

HTML DOM Level 2|W3C

text_javascript Navioo_docs

Ajax Javascript feed

↑ Grab this Headline Animator