DOM and BOM
In JavaScript, both DOM and BOM are crucial objects that provide access to different aspects of the web browsing experience.
DOM (Document Object Model):
Examples: Accessing elements by ID or class name, changing element content, adding event listeners to elements.
BOM (Browser Object Model):
Examples: Opening a new window, accessing the user's location, checking the browser's screen resolution.
DOM (Document Object Model):
1. Focus: Represents the structure and content of the current web page (HTML document).
2. Structure: A tree-like hierarchy where each node represents an element in the HTML document.
3. Functionality: Allows you to manipulate the document, such as adding, removing, modifying elements, changing styles, and responding to user interactions.
2. Structure: A tree-like hierarchy where each node represents an element in the HTML document.
3. Functionality: Allows you to manipulate the document, such as adding, removing, modifying elements, changing styles, and responding to user interactions.
Examples: Accessing elements by ID or class name, changing element content, adding event listeners to elements.
BOM (Browser Object Model):
1. Focus: Provides access to the browser window, history, and other features beyond the specific document.
2. Structure: Not a tree, but rather a collection of objects representing various browser features.
3. Functionality: Allows you to interact with the browser itself, such as navigating to new pages, reading browser information (user agent, screen size), manipulating the browser window, and accessing history.
2. Structure: Not a tree, but rather a collection of objects representing various browser features.
3. Functionality: Allows you to interact with the browser itself, such as navigating to new pages, reading browser information (user agent, screen size), manipulating the browser window, and accessing history.
Examples: Opening a new window, accessing the user's location, checking the browser's screen resolution.
Comments
Post a Comment