HTML DOM Document Object

Source: Internet
Author: User

Document Object Properties and methods

The above properties and methods can be used in HTML documents:

Properties/Methods Description
Document.activeelement Returns the currently acquired focus element
Document.addeventlistener () To add a handle to a document
Document.adoptnode (node) Returns a adapded node from another document to the current document.
Document.anchors Returns a reference to all Anchor objects in the document.
Document.applets Returns a reference to all Applet objects in the document.
Document.baseuri Returns the absolute base URI of the document
Document.body Returns the BODY element of the document
Document.close () Closes the output stream opened with the Document.open () method and displays the selected data.
Document.cookie Sets or returns all cookies related to the current document.
Document.createattribute () Create an attribute node
Document.createcomment () The Createcomment () method creates an annotation node.
Document.createdocumentfragment () Creates an empty DocumentFragment object, and returns this object.
Document.createelement () Creates an element node.
document.createTextNode () Creates a text node.
Document.doctype Returns document type declarations (DTDs) related to documents.
Document.documentelement Returns the root node of the document
Document.documentmode Returns the mode used to render the document through the browser
Document.documenturi Sets or returns the location of a document
Document.domain Returns the domain name of the current document.
Document.domconfig Returns the configuration used when the Normalizedocument () is called
Document.embeds Returns a collection of all embedded content (embed) in a document
Document.forms Returns a reference to all Form objects in the document.
Document. Getelementsbyclassname () Returns the collection of elements for all specified class names in the document as NodeList objects.
document.getElementById () Returns a reference to the first object that owns the specified ID.
Document.getelementsbyname () Returns a collection of objects with the specified name.
document.getElementsByTagName () Returns a collection of objects with the specified label name.
Document.images Returns a reference to all the Image objects in the document.
Document.implementation Returns the Domimplementation object that processed the document.
Document.importnode () Copy a node from another document to the document for application.
Document.inputencoding Returns the encoding used for the document (at parse time).
Document.lastmodified Returns the date and time when the document was last modified.
Document.links Returns a reference to all area and Link objects in the document.
Document.normalize () Delete empty text nodes and connect adjacent nodes
Document.normalizedocument () Deletes an empty text node, and joins the adjacent node's
Document.open () Open a stream to collect the output from any document.write () or Document.writeln () method.
Document.queryselector () Returns the first element in the document that matches the specified CSS selector
Document.queryselectorall () Document.queryselectorall () is a new method introduced in HTML5 that returns a list of all element nodes of a matching CSS selector in the document
Document.readystate Return document status (load ...)
Document.referrer Returns the URL of the document loaded into the current document.
Document.removeeventlistener () Remove an event handle from a document (added by the AddEventListener () method)
Document.renamenode () Renames an element or attribute node.
Document.scripts Returns a collection of all the scripts in the page.
Document.stricterrorchecking Sets or returns whether to force error checking.
Document.title Returns the title of the current document.
Document. Url Returns the full URL of the document
document.write () Write an HTML expression or JavaScript code to the document.
Document.writeln () is equivalent to the Write () method, unlike writing a newline character after each expression.

Warning!!!

The document object inherits all of the properties and methods of the node object at the core of the audience dom.

Many properties and methods are meaningless in the document.

HTML Document objects can avoid using these node objects and properties:

Properties/Methods reasons to avoid
Document.attributes Document does not have this property
Document.hasattributes () Document does not have this property
Document.nextsibling The document does not have a next node
Document.nodename This is usually #document
Document.nodetype This is usually 9 (document_node)
Document.nodevalue Document does not have a node value
Document.ownerdocument Document does not have a main document
Document.ownerelement The document does not have its own node
Document.parentnode Document does not have parent node
Document.previoussibling Document does not have sibling nodes
Document.textcontent Document does not have a text node

HTML DOM Document Object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.