


The difference and relationship between BOM and DOM_html/css_WEB-ITnose
BOM
1. BOM is the abbreviation of Browser Object Model, which is the browser object model.
2. There is no relevant standard for BOM.
3. The most fundamental object of BOM is window.
As can be seen from 1: BOM and browser are closely related. Many things in the browser can be controlled through JavaScript, such as opening a new window, opening a new tab (tab), closing the page, setting the webpage as the homepage, or adding it to favorites, etc... The objects involved are BOM.
As can be seen from 2: Since there is no standard, different browsers may require different implementation methods to implement the same function. For the functions mentioned above, different browsers may require different JavaScript codes to implement the functions.
For example, adding a favorite function:
IE browser: window.external.AddFavorite(url,title);
FireFox browser: window.sidebar.addPanel (title, url, "");
So when writing this piece of JavaScript code, you must consider browser compatibility.
Although there is no set standard for BOM, the JavaScript codes for common functions of various browsers are still similar. There are actually default standards for common functions. So don’t worry too much about browser compatibility. Not every browser has its own BOM, and you don’t need to learn a set of BOM for each browser. It’s just that some browsers will have new functions that will be reflected in the BOM. .
DOM
1. DOM is the abbreviation of Document Object Model, which is the document object model.
2. DOM is a W3C standard.
3. The most fundamental object of DOM is document (actually window.document).
As can be seen from 1: DOM is related to documents. The documents here refer to web pages, which are HTML documents. The web page is sent by the server to the client browser. No matter what browser is used, the received HTML is the same, so the DOM has nothing to do with the browser. It focuses on the content of the web page itself. Since it has little to do with the browser, the standard can be easily determined.
Now that there are standards, everyone must abide by the standards. Browsers that do not abide by the standards will be spanked.
So what does JavaScript’s DOM do?
We know that HTML is composed of tags, tags within tags. JavaScript can get through the DOM what tags there are, what are the attributes in the tags, what is the content, etc...
As can be seen from the window.document in 3, the most fundamental object of the DOM is the window of the BOM A child object of the object.
The above picture illustrates the relationship between the two very well: the relationship between the two is that BOM contains DOM.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.
