Home  >  Article  >  Web Front-end  >  Javascript DOM vs BOM!

Javascript DOM vs BOM!

DDD
DDDOriginal
2024-09-14 06:21:02692browse

Javascript DOM vs BOM!

DOM

DOM stands for Document Object Model and represents the web page. This allows programs to manipulate the document structure, style, and content.

const listDiv = document.getElementById("list-div");

listDiv.classList.add('new-class');
listDiv.classList.remove('new-class');

BOM

BOM stands for Browser Object Model and represents the browser's window. This allows programs to access browsers functionalities. BOM is like the big container which contains DOM and all other javascript stuff.

// DOM is part of BOM.
window.document.getElementById("list-div");

window.innerHeight
window.location.href
window.alert("some-text");

The above is the detailed content of Javascript DOM vs BOM!. For more information, please follow other related articles on the PHP Chinese website!

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