Get the element through the tag and return an array; get the page element through the id; get the page element through the class name and other methods to get the html element of the page.
1. Get elements through tags and return an array
var li=document.getElementsByTagName(li);/Tag gets elements li[o].innerHTML;/View get elements content. li[o].innerHTML="content";/lModify the content obtained in the tag.
2. Get the page element by id
var header=document.getElementByld("header");/lid Get the element.
3. Get page elements through class names
var list=document.getElementsByClassName("ist")/I returns an array and accesses text through subscripts.
HTML element syntax
HTML elements start with a start tag and HTML elements end with an end tag. The content of an element is the content between the start tag and the end tag. Some HTML elements have empty content. Empty elements are closed in the start tag (end with the end of the start tag). Most HTML elements can have property.
Most HTML elements can be nested (can contain other HTML elements). HTML documents are composed of nested HTML elements. HTML elements with no content are called empty elements. Empty elements are closed in the opening tag. In XHTML, XML, and future versions of HTML, all elements must be closed.