DOM and BOM of understanding

 
A, DOM
DOM stands for Document Object Model, which is the document object model.
Personal understanding, DOM comprising three meanings: 1.DOM is an API interface operation HTML is an HTML 2.DOM structural model refers to an object on behalf of the HTML 3.DOM model
 
HTML is a 1.DOM operation API interface
HTML itself is static, constant, and each tag content attributes are dead.
If you want the pages to move, it must complete two steps: The first step is to change the thinking (the page can move up), the second part is the breakthrough operation (how to move)
DOM completed the above steps, it is first of all to find a breakthrough in the compaction of HTML, we define some things can be changed, and later for these breakthrough designed a series of API, the API so that people can manipulate these elements.
 
2.DOM HTML is a structural model
Before DOM comes out, I think HTML file for a lot of people just follow special rules for some of the text, but gave it establishes a DOM structure model, making three-dimensional again.
This figure is below the
 
3.DOM behalf of that model objects in the HTML
Sentence, DOM node that is in the figure above.
 
 
二, GOOD
 
BOM is the Browser Object Model, the browser object model.
 
Simply put, BOM and DOM same, but DOM manipulation is in HTML elements, BOM is a browser API, the operation of the browser (that is, to control the browser's behavior)
 
3. The functions of the division of DOM and BOM 

As shown below, wherein E region (also known as the Document, he developer corresponding to write out a folder, there index.html, css and jsdeng) return pipe DOM

ABCD area owned BOM tube

 

Fourth, the common object

document is an object of DOM

document.title = 'ForHope' --- to define the document title

document.getElementById ( 'xxx') --- get a certain element in the document

window, location of two objects BOM

window.close --- close the current window

location.href = "www.baidu.com" --- let the browser to jump to another page

 

 

 

 

Reference Links: https://blog.csdn.net/zixiaomuwu/article/details/60588461

Guess you like

Origin www.cnblogs.com/hopeiscoming/p/12227939.html