Home  >  Article  >  Web Front-end  >  what is dom

what is dom

云罗郡主
云罗郡主Original
2018-12-05 15:00:4083072browse

dom is a document object model, and it is also an interface for HTML programming. The elements in the page are manipulated through DOM. When the HTML page is loaded, the browser will create a DOM for the document. Provides a new logical structure, and can change the content and structure.

what is dom

#The operating environment of this article: Windows 7 system, Dell G3 computer.

What is dom? Many people have heard of dom, but don't know what attributes dom has. The following PHP Chinese website will explain dom for you.

1: What is dom

dom is a document object model and an interface for HTML programming. Elements in the page are manipulated through dom. When an HTML page is loaded, the browser creates a DOM, which provides a new logical structure to the document and can change the content and structure.

DOM is object-oriented and defines the objects needed to modify the document and the relationship between each object. We can also regard the DOM on the page as a tree structure and add layout to the HTML document through js. , if js wants to access elements in html, it must obtain them through the object model.

2: How to get elements from dom

1. In HTML, we all know that web pages are organized with many tags, but the ids of these tags are unique Yes, we only need to find the corresponding tag through the ID number, and then perform the operation.

2. We can also get elements by name, and the search returns a collection of named objects. The name attribute of the element is used to query, but since the name element may not be a unique value, the return is an array, not an element.

3. Get it by specifying the attributes of the element node.

The above is a complete introduction to what dom is. If you want to know more about JavaScript video tutorial, please pay attention to the php Chinese website.

The above is the detailed content of what is dom. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn