ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

JavaScript-DOM对象

2022-05-14 16:31:49  阅读:6  来源: 互联网

标签:DOM p2 Dom 对象 JavaScript father var document 节点


核心
浏览器网页就是一个DOM树形结构!
更新Dom节点
遍历Dom节点
删除Dom节点
添加Dom节点

<div id="father">
        <h1>标题</h1>
        <p id="p1">p1</p>
        <p class="p2">p2</p>
    </div>
    <script>
        var h1 = document.getElementsByTagName('h1');
        var p1 = document.getElementById('p1');
        var p2 = document.getElementsByClassName('p2');
        var father = document.getElementById('father');

        var children = father.children;
    </script>

标签:DOM,p2,Dom,对象,JavaScript,father,var,document,节点
来源: https://www.cnblogs.com/speak-please/p/16270492.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有