dom 代表文档对象模型,代表网页。这允许程序操纵文档结构、样式和内容。
const listdiv = document.getelementbyid("list-div"); listdiv.classlist.add('new-class'); listdiv.classlist.remove('new-class');
bom 代表浏览器对象模型,代表浏览器的窗口。这允许程序访问浏览器功能。 bom 就像一个大容器,其中包含 dom 和所有其他 javascript 内容。
// DOM is part of BOM. window.document.getElementById("list-div"); window.innerHeight window.location.href window.alert("some-text");
以上就是JavaScript DOM 与 BOM!的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号