Dom Note (i): HTMLDocument interface

Source: Internet
Author: User

The first step in manipulating an HTML document is to get a reference to the document element, where each element is a node in the DOM, and all the elements form a node tree in the DOM.

The method used to get the element node definition is defined in the HTMLDocument interface, the Window.document method is used to implement the interface, and the common methods and properties of its definition are as follows:

Property or method return value type Description
[Getter] Any type Gets all element nodes based on the element's Name property
All Htmlallcollection A collection of all the elements in the document that are deprecated
Body HtmlElement Get <body> element node
Head Htmlheadelement Get
Images Htmlcollection Get all ELEMENT nodes
Embeds Htmlcollection Get all <embed> ELEMENT nodes
Plugins Htmlcollection Equivalent to the Embeds property
Links Htmlcollection Gets all <a> and <area> element nodes with the href attribute
Forms Htmlcollection Get all <form> ELEMENT nodes
Scripts Htmlcollection Get all <script> ELEMENT nodes
Getelementsbyname () NodeList Gets all element nodes based on the element's Name property
Getelementsbyclassname () NodeList Get all ELEMENT nodes based on the class property of the element

In addition, the HTMLDocument interface inherits the document interface of the core DOM, inheriting the following properties and methods:

Property or method return value type Description
DocumentElement Element Get the root element of XML or HTML,
getElementById () Element Gets the specified element based on the ID property value
getElementsByTagName () NodeList Get all element nodes based on element name
Getelementsbytagnamens () NodeList Gets all element nodes based on the element name of the specified namespace
Original starting: Http://www.ido321.com/1315.html
‘
Next: Dom Notes (ii): node interface

Dom Note (i): HTMLDocument interface

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.