1. 程式人生 > >HTML DOM 物件的屬性和方法

HTML DOM 物件的屬性和方法

  • getElementById(id) ———— 獲取帶有指定id的節點元素。
  • getElementByTagName(tagename)———– 獲取相應標籤元素的子元素集合,它允許吧萬用字元作為它的引數,“”*“”一般是放在引號中以區分乘號。返回值是偽陣列。
  • getElementByClassName(classname) ———– 獲取帶有指定classname的節點,返回值是陣列。
  • getAttribute() ———— 返回指定的屬性值。
  • setAttribute() ———— 設定指定屬性的值。
  • appendChild() ———— 插入新的子節點。
  • removeChild() ———— 刪除子節點。
  • replaceChile() ———— 替換子節點。
  • insertBefore() ———— 在指定的子節點前面插入新的子節點。
  • createAttribute() ———— 建立屬性節點。
  • createElement() ————- 建立元素節點。
  • createTextNode() ————- 建立文字節點。
  • -