JavaScript learning: Differences and associations between BOM and DOM

Source: Internet
Author: User

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, to add a feature like favorites: IE browser: window. external. addFavorite (url, title); FireFox browser: window. sidebar. addPanel (title, url, ""); so when writing this JavaScript code, you must consider browser compatibility. 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 domis 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.

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.