美文网首页
DOM常用api和属性

DOM常用api和属性

作者: 小旎子_8327 | 来源:发表于2019-05-06 18:03 被阅读0次

    节点类型

    image.png

    节点方法

    1. 创建节点
      createElement()
      createAttribute()
      createTextNode()
    2. 获取节点
      getElementById(id)
      getElementsByTagName()
      getElementsByClassName()
    3. 添加、替换、删除节点
      appendChild()
      removeChild()
      replaceChild()
      insertBefore()
    4. 设置及获取属性
      getAttribute()
      setAttribute()

    属性

    innerHTML
    innerText

    相关文章

      网友评论

          本文标题:DOM常用api和属性

          本文链接:https://www.haomeiwen.com/subject/yevdoqtx.html