Differences and associations between BOM and DOM, and BOMDOM
BOM
1. BOM is short for Browser Object Model, that is, Browser Object Model.
2. BOM has no relevant standards.
3.The most fundamental object of BOM is window.
From 1, we can see that BOM is closely related to the browser. Many browser things can be controlled through JavaScript, such as opening a new window, opening a new tab (Tab), closing the page, setting the webpage as the home page, or adding to favorites, etc... These objects are BOM.
As can be seen from 2: because there is no standard, different browsers can implement the same function in different ways. For the functions mentioned above, the JavaScript code required for different browser implementation functions may be different.
For example, adding a feature to favorites:
IE browser: window. external. AddFavorite (url, title );
FireFox: window. sidebar. addPanel (title, url ,"");
Therefore, browser compatibility should be considered when writing this JavaScript code.
Although BOM does not have a set of standards, the JavaScript code for common functions of various browsers is still similar, and there are actually default standards for common functions. Therefore, you don't have to worry too much about browser compatibility. Not every browser has its own BOM, and you don't need to learn a BOM for every browser, only some browsers will display new features on BOM.
DOM
1. DOM is short for Document Object Model, that is, Document Object Model.
2. DOM is W3C standard.
3.The most fundamental object of DOM is document.(Upload upload Doc ument ).
From 1, we can see that DOM is related to documents. The documents here refer to webpages, that is, HTML documents. A webpage is sent to the client browser by the server. The HTML received by any browser is the same, so DOM is irrelevant to the browser. It focuses on the content of the webpage. Because it has little to do with the browser, the standards are fine.
Now that there is a standard, we have to follow the standard, and browsers that do not follow the standard will have to be tapped.
So what does JavaScript DOM do?
We know that HTML consists of tags and tag sets. JavaScript can use the DOM to obtain the tags, the attributes in the tag, and the content...
As can be seen from the "too many Doc ument" in 3rd, the most fundamental object of DOM is the sub-object of the window object of BOM.
The relationship between the two is as follows: BOM contains DOM.