DOM Document

Document Object

Property / Method Description
doc.activeElementReturns the currently focused element in the document
doc.addEventListener()Attaches an event handler to the document
doc.adoptNode()Adopts a node from another document
doc.anchorsReturns a collection of all <a> elements in the document that have a name attribute
doc.appletsReturns a collection of all <applet> elements in the document
doc.baseURIReturns the absolute base URI of a document
doc.bodySets or returns the document's body (the <body> element)
doc.close()Closes the output stream previously opened with document.open()
doc.cookieReturns all name/value pairs of cookies in the document
doc.createAttribute()Creates an attribute node
doc.createComment()Creates a Comment node with the specified text
doc.createDocumentFragment()Creates an empty DocumentFragment node
doc.createElement()Creates an Element node
doc.createTextNode()Creates a Text node
doc.doctypeReturns the Document Type Declaration associated with the document
doc.documentElementReturns the Document Element of the document (the <html> element)
doc.documentModeReturns the mode used by the browser to render the document
doc.documentURISets or returns the location of the document
doc.domainReturns the domain name of the server that loaded the document
doc.domConfigObsolete. Returns the DOM configuration of the document
doc.embedsReturns a collection of all <embed> elements the document
doc.formsReturns a collection of all <form> elements in the document
doc.getElementById()Returns the element that has the ID attribute with the specified value
doc.getElementsByClassName()Returns a NodeList containing all elements with the specified class name
doc.getElementsByName()Returns a NodeList containing all elements with a specified name
doc.getElementsByTagName()Returns a NodeList containing all elements with the specified tag name
doc.hasFocus()Returns a Boolean value indicating whether the document has focus
doc.headReturns the <head> element of the document
doc.imagesReturns a collection of all <img> elements in the document
doc.implementationReturns the DOMImplementation object that handles this document
doc.importNode()Imports a node from another document
doc.inputEncodingReturns the encoding, character set, used for the document
doc.lastModifiedReturns the date and time the document was last modified
doc.linksReturns a collection of all <a> and <area> elements in the document that have a href attribute
doc.normalize()Removes empty Text nodes, and joins adjacent nodes
doc.normalizeDocument()Removes empty Text nodes, and joins adjacent nodes
doc.open()Opens an HTML output stream to collect output from document.write()
doc.querySelector()Returns the first element that matches a specified CSS selector(s) in the document
doc.querySelectorAll()Returns a static NodeList containing all elements that matches a specified CSS selector(s) in the document
doc.readyStateReturns the (loading) status of the document
doc.referrerReturns the URL of the document that loaded the current document
doc.removeEventListener()Removes an event handler from the document (that has been attached with the addEventListener() method)
doc.renameNode()Renames the specified node
doc.scriptsReturns a collection of <script> elements in the document
doc.strictErrorCheckingSets or returns whether error-checking is enforced or not
doc.titleSets or returns the title of the document
doc.URLReturns the full URL of the HTML document
doc.write()Writes HTML expressions or JavaScript code to a document
doc.writeln()Same as write(), but adds a newline character after each statement
Note: Documents inhert all Node properties, but...
doc.attributesDocuments don't have attributes
doc.hasAttributes()Documents don't have attributes
doc.nextSiblingDocuments don't have siblings
doc.nodeNameThis is always #document
doc.nodeTypeThis is always 9 (DOCUMENT_NODE)
doc.nodeValueDocuments don't have an node value
doc.ownerDocumentDocuments don't have an owner document
doc.ownerElementDocuments don't have an owner element
doc.parentNodeDocuments don't have a parent node
doc.previousSiblingDocuments don't have siblings
doc.textContentDocuments don't have a text content
  
Property / Method Description