First, find the element:
1.getElementById (): Receives a parameter: the ID of the element to be taken. Returns the element if the corresponding element is found, or null if no element with the corresponding ID exists. Match strictly, including case.
IE7 and lower versions also added an interesting "quirk" to this method: the form element with the name attribute matching the given ID (<input>, <textarea>, <button>, and <select> ) will also be returned by this method. If the name attribute of a FORM element equals the specified ID, and the element is in front of the element with the given ID in the document, IE returns that form element.
2.getElementsByTagName (). This method takes a parameter, which is to get the label name of the element, and returns a NodeList that contains 0 or more elements.
3.getElementsByName (). As the name implies, this method returns all elements with the given name attribute. The most common use of the Getelementsbyname () method is to obtain a radio button.
Second, find the element direct point:
1. Element. ChildNodes: read-only attribute child node list collection, which contains text and element type nodes.
2. Element. Children: read-only attribute child node list collection, containing only element type nodes.
3. Element. NodeType: Read-only property the node type of the current element
ELEMENT node: 1
Attribute node: 2
Text nodes: 3
<! DOCTYPE html>
<! DOCTYPE html>
Summary: IE8 in children and ChildNodes properties, including annotation nodes and ELEMENT nodes. But after the IE9 version children returns only the ELEMENT nodes, ChildNodes returns comments, blanks, and ELEMENT nodes.
Child nodes in JavaScript find, childnodes and children