Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the properties and methods of the doucument object in javascript

Shulou Source: shulou.com Published: 2022-06-01 19:26:20 10月03日 Update

This article mainly introduces the relevant knowledge of the properties and methods of doucument object in javascript, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will have something to gain after reading this article on the properties and methods of doucument object in javascript, let's take a look.

The properties and methods of the doucument object are: body, cookie, domain, lastModified, referrer, title, close (), open (), write (), getElementById (), normalize (), and so on.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Document object

Every HTML document loaded into the browser becomes a Document object.

The Document object gives us access to all the elements in the HTML page from the script.

Tip: the Document object is part of the Window object and can be accessed through the window.document property.

Document object properties and methods

The following properties and methods are available in HTML documents:

Property / method description document.activeElement returns the current acquisition focus element document.addEventListener () to add a handle to the document document.adoptNode (node) to return the adapded node from another document to the current document. Document.anchors returns references to all Anchor objects in the document. Document.applets

Returns references to all Applet objects in the document.

Note: elements are no longer supported by HTML5.

Document.baseURI returns the absolute basis of the document URIdocument.body returns the body element document.close () of the document closes the output stream opened with the document.open () method and displays the selected data. [xss_clean] sets or returns all cookie related to the current document. Document.createAttribute () creates an attribute node the document.createComment () createComment () method creates a comment node. Document.createDocumentFragment () creates an empty DocumentFragment object and returns it. Document.createElement () creates the element node. Document.createTextNode () creates a text node. Document.doctype returns the document type declaration (DTD) associated with the document. Document.documentElement returns the root node of the document document.documentMode returns the mode document.documentURI setting or returns the location of the document through the browser document.domain returns the domain name of the current document. Document.domConfig is obsolete. Returns the configuration used when normalizeDocument () is called. Document.embeds returns the collection of all embedded embed in the document document.forms returns references to all Form objects in the document. Document.getElementsByClassName () returns a collection of all the elements in the document with the specified class name 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 tag signature. Document.images returns references to all Image objects in the document. Document.implementation returns the DOMImplementation object that processes the document. Document.importNode () copies a node from another document to that document for application. Document.inputEncoding returns the encoding used for the document (when parsing). Document.lastModified returns the date and time when the document was last modified. Document.links returns references to all Area and Link objects in the document. Document.normalize () deletes empty text nodes and connects neighboring nodes document.normalizeDocument () deletes empty text nodes, and document.open () that connects neighboring nodes opens a stream to collect output from any [xss_clean] () or [xss_clean] ln () methods. 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, which returns the list of all element nodes of the matching CSS selector in the document document.readyState returns the document status (loading.) Document.referrer returns the URL of the document loaded into the current document. Document.removeEventListener () removes the event handle from the document (added by the addEventListener () method) document.renameNode () renames the element or attribute node. Document.scripts returns a collection of all the scripts in the page. Document.strictErrorChecking sets or returns whether error checking is enforced. Document.title returns the title of the current document. Document.URL returns the complete URL of the document [XSS _ clean] () to write HTML expressions or JavaScript code to the document. [xss_clean] ln () is equivalent to the write () method, except that a newline character is written after each expression. This is the end of the article on "what are the properties and methods of doucument objects in javascript?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the properties and methods of doucument objects in javascript". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Documents objects methods nodes attributes elements content text knowledge handles browsers articles scripts expressions pages browsing output selections differences events Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux Microsoft Xiaomi Apple