Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”
This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
Hi, I’m Ken
Author: Please call me Ken Link: juejin.cn/user/109118… The copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.
🌊🌈
Part of the content and pictures of the article are from the Internet. If you have any questions, please contact me (there is an official account in the introduction of the home page).
This blog is suitable for just contactJS
And the friends who want to review after a long time.
🌊🌈
The following is part 8 of the BOM
8.1 introduction of BOM
In the actual development, when using JavaScript to develop Web programs, it is often necessary to visit the browser and other operations to achieve dynamic interaction between the browser and the page. To this end, the BOM provides a number of objects for accessing the browser. This section explains in detail what constitutes a BOM.
8.1.1 What is BOM
The Brower Object Model (BOM) provides objects that interact with browser Windows independently of content. The core Object is Window.
A BOM is made up of a series of related objects, and each object provides a number of methods and attributes. But BOM lacks standards. ECMA is the standardisation body for JavaScript syntax, W3C is the standardisation body for DOM, and BOM was originally part of the Netscape browser standard.
8.1.2 Difference between BOM and DOM
DOM is the document object model, which treats the document as an object, and its top object is document, and we’ll learn how to manipulate page elements. DOM is a W3C standard specification.
BOM is the browser object model, which treats the browser as an object. The top object of BOM is window. We mainly study some objects that the browser window interacts with. BOM is defined by browser vendors on their browsers and is not compatible with each other.
8.1.3 BOM Composition
The BOM provides many objects. These objects are used to access the browser and are called browser objects. The hierarchy of built-in objects is called the browser object model,
The structure of the BOM
As you can see from the figure, BOM is larger than DOM. It contains DOM (Doumemt). The core object of BOM is Window. The Window object is a top-level object of the browser. It plays a dual role as both an interface for JavaScript to access the browser window and a global object. Variables and functions defined in the global scope become properties and methods of the Window object. Example code is as follows:
<script>
// Variables in the global scope are properties of the window object
var num = 10;
console.log (num);
// Result is: 10
console.log (window.num);
// Result is: 10
// Global functions in the city are methods of the window object
function fn() {
console.log(11);
}
fn(); // Result: 11
window.fn();// Result: 11
</script>
Copy the code
In the previous section, you can also assign to an undeclared variable by omitting var because the variable is automatically converted to a property of the Window object. The previously learned alert() and prompt() methods belong to the window object and omit the preceding “window.” when called. Since the window object has a name attribute, it is not recommended to use name for variables declared in the global scope to avoid conflicts with the name attribute of the window object.
That’s the end of today’s introductory study
Peace
🌊🌈
HTML Getting Started Guide learning Column “Finished” :
A Ken HTML, CSS introduction guide (a)_HTML basics a Ken HTML, CSS introduction guide (b)_HTML page elements and attributes a Ken HTML, CSS introduction guide (c)_ text style attributes Ken HTML, CSS introduction guide (four)_CSS3 selector Ken HTML, CSS introduction guide (five)_CSS box model Ken HTML, CSS introduction guide (six)_CSS box model Ken HTML, CSS introduction guide (seven)_CSS box model Ken’s Getting Started with HTML and CSS (8)_CSS box model Ken’s Getting Started with HTML and CSS (9)_ Floating and Positioning Ken’s Getting Started with HTML and CSS (10)_ Floating and Positioning Ken’s getting Started with HTML and CSS (11)_ Floating and positioning Ken’s introduction to HTML and CSS (12)_ The application of forms The introduction to HTML and CSS (13)_ the application of forms (14)_ the application of forms the introduction to HTML and CSS (15)_ the application of forms Ken’s introduction to HTML and CSS (16) _ Multimedia Technology (17) _ Multimedia technology challenge the minimum time to bring you into HTML (18) challenge the minimum time to bring you into HTML (20)
Javascript Getting Started Guide Learning Column “In update” :
Suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (a) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (2) suggest collection 】 【 share | JS dry challenge the shortest time to take you into the JS (3) the share | JS dry Recommended collection 】 challenge the shortest time take you into the JS (4) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (5) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (6) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (7) Suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (eight) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (nine) suggest collection 】 【 share | JS dry challenge the shortest time to take you into the JS (10) 【 share | JS dry goods Recommended collection 】 challenge the shortest time take you into the JS (11) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (12) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (13) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (14) Suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (15) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (16) suggest collection 】 【 share | JS dry challenge the shortest time to take you into the JS (17) 【 share | JS dry goods Recommended collection 】 challenge the shortest time take you into the JS (18) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (19) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (20) suggest collection 】 【 share | JS dry challenge the shortest time take you into the JS (21) Suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (22) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (23) suggest collection 】 【 share | JS dry challenge the shortest possible time to take you into the JS (24)
🌊🌈 About postscript:
Thank you to meet hello I am Ken personal wechat: WLPChaojiBang Have questions please feel free to communicate with me, a person can go fast, but a group of people can go farther! “Attention” : improve learning efficiency! 👍🏻 : original is not easy, appropriate encouragement! ⭐ : Collect articles, review the old and learn the new! 💬 : Comment exchange, common progress!