BOM is another object model after learning the DOM document object model--------- browser object model, which provides a series of objects that interact with the browser window independently of content, and each object There are many methods and properties, the core object and the top-level object are window
Let's review the difference between DOM and BOM:
DOM:
- Document Object Model
- The top-level object is document
- The main learning content is to operate page elements
- The standard is the W3C standard specification
BOM:
- Browser Object Model
- The top-level object is window
- The main learning is the interaction of the browser window
- BOM is set by browser manufacturers in their respective browsers, and the compatibility is very poor
We need to understand clearly: BOM is bigger than DOM, DOM is contained in BOM
The window object is the top-level object of the browser. It is not only an interface for JS to access the browser , but also a global object . Variables and functions defined in the global scope will become a method of it: but when calling, we usually To save window, just console.log(a) directly. For example, I am from Henan. When I tell others about my province, I don’t need to say that I am from Henan, China.
<script>
var a=100;
console.log(window.a);
</script>