search
HomeWeb Front-endHTML TutorialThe 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.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

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.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

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.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?Apr 05, 2025 pm 01:24 PM

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...

What HTML elements does the online code editor use to implement code input?What HTML elements does the online code editor use to implement code input?Apr 05, 2025 pm 01:21 PM

HTML Element Analysis in Web Code Editor Many online code editors allow users to enter HTML, CSS, and JavaScript code. Recently, someone proposed...

React static page construction: How to avoid code compression with react-app-rewired?React static page construction: How to avoid code compression with react-app-rewired?Apr 05, 2025 pm 01:18 PM

About how to avoid code compression when building static pages using react-app-rewired Many developers want to deliver to...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software