DOM淺談

先附上一個DOM的教程:http://www.w3school.com.cn/htmldom/dom_methods.asphtml

   DOM的結構實際上和數據結構裏面的樹很是類似數組

方法 描述
getElementById() 返回帶有指定 ID 的元素。
getElementsByTagName() 返回包含帶有指定標籤名稱的全部元素的節點列表(集合/節點數組)。
getElementsByClassName() 返回包含帶有指定類名的全部元素的節點列表。
appendChild() 把新的子節點添加到指定節點。
removeChild() 刪除子節點。
replaceChild() 替換子節點。
insertBefore() 在指定的子節點前面插入新的子節點。
createAttribute() 建立屬性節點。
createElement() 建立元素節點。
createTextNode() 建立文本節點。
getAttribute() 返回指定的屬性值。
setAttribute() 把指定屬性設置或修改成指定的值。
相關文章
相關標籤/搜索