DOM筆記

DOM方法:node

  • getElementById(id) - 獲取帶有指定 id 的節點(元素)
  • appendChild(node) - 插入新的子節點(元素)
  • removeChild(node) - 刪除子節點(元素)
  • replaceChild() - 替換子節點
  • insertBefore()
  • createAttribute()  建立屬性節點
  • createElement()
  • createTextNode()
  • getAttribute()  返回指定的屬性值
  • setAttribute()  把指定屬性設置或修改成指定的值

DOM屬性:app

  • innerHTML - 節點(元素)的文本值
  • parentNode - 節點(元素)的父節點
  • childNodes - 節點(元素)的子節點
  • attributes - 節點(元素)的屬性節點
  • nodeName
  • nodeValue
相關文章
相關標籤/搜索