[Go] JavaScript Learning: BOM and Dom Differences and associations

Source: Internet
Author: User

Bom

1. The BOM is the abbreviation for the Browser object model , which is the browser-based one.

2. The BOM has no relevant standards.

3. The most fundamental object of the BOM is window.

As you can see from 1, theBOM is closely related to the browser . A lot of things in the browser can be controlled by JavaScript, such as opening a new window, opening a new tab (tab), closing the page, setting the page as the homepage, or adding a favorite folder, etc... The objects involved are the BOM.

As can be seen from 2: because there is no standard, different browsers implement the same function, you can need a different way of implementation. for the functionality described above, the JavaScript code required for different browser implementations might not be the same.

For example, to add a collection such a feature:
IE browser: window.external.AddFavorite (url,title);

Firefox browser: window.sidebar.addPanel (title, URL, "");

So when you write this piece of JavaScript code, you need to consider browser compatibility.

Although the BOM does not have a set of standards, but the common features of each browser JavaScript code is still the same, for the commonly used features have in fact already has the default standard. so do not worry about browser compatibility issues, not every browser has its own BOM, do not need to learn a set of BOM for each browser, but the individual browser will have new features will be reflected in the BOM.

Dom

1. The DOM is the abbreviation for the Document Object model, which refers to the documentation objects models .

2. The DOM is the standard for the consortium.

3. The most fundamental object of the DOM is document (actually window.document).

As you can see from 1, the DOM is related to the document, where the document refers to the Web page, which is the HTML document . Web pages are sent to the client browser by the server, regardless of the browser, the received HTML is the same, so Dom and browser-independent, it is concerned about the content of the Web page itself. because of the relationship with the browser is not big, so the standard is OK.

Since there are standards, we will follow the standard, not according to the standard browser will hit the buttocks.

So what does the DOM of JavaScript do?

We know that HTML is made up of labels, label sets, tags. JavaScript can get through the DOM what the tags are, what the attributes are, what the content is, and so on ...

As can be seen from the 3 window.document, the most fundamental object of the DOM is the sub-object of the BOM's Window object.

Photo from: http://www.dreamdu.com/

Good description of the relationship between the two: the relationship is that the BOM contains the DOM.

Fork Brother reproduced please indicate the source: http://blog.csdn.net/xiao__gui/article/details/8315148

[Go] JavaScript Learning: BOM and Dom Differences and associations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.