核心dom和html dom的區別

2022-09-13 02:09:10 字數 959 閱讀 3761

核心dom :

物件:document,node,   elementnode,textnode,attributenode,commentnode,nodelist 

核心dom提供了統一的操作介面:

createelement

setattribute

removeattribute

nodename

核心dom建立新元素:

var newnode=document.createelement("img")

給元素新增屬性:

e.setattribure(『』,『』)

e.setattriburenode(attr)

適用場合:

核心dom適合操作節點,如建立,刪除,查詢等

html dom:

物件:image,table,form,input,select...html標籤物件化

html dom提供了封裝好的各種物件:

image

select

option

html dom建立新元素:

var newnode=new image();

給元素新增屬性:

img.src='';

img.id='';

imd.title='';

img.classname=''

img.style.display='';

適用場合:

html dom適合操作屬性,如讀取或修改屬性的值

核心dom和html dom的區別

核心dom 物件 document,node,elementnode,textnode,attributenode,commentnode,nodelist 核心dom提供了統一的操作介面 createelement setattribute removeattribute nodename 核心d...

HTML DOM與核心DOM的區別

dom分為三部分 1 核心dom 遍歷dom樹 新增新節點 刪除節點 修改節點 2 html dom 以一種簡便的方法訪問dom樹 3 xml dom 準用於操作xml文件 核心dom與html dom的區別 核心dom 物件 document,node,elementnode,textnode,a...

DOM與HTML DOM的區別與聯絡

dom分為三部分 1 核心dom 遍歷dom樹 新增新節點 刪除節點 修改節點 2 html dom 以一種簡便的方法訪問dom樹 3 xml dom 準用於操作xml文件 核心dom與html dom的區別 核心dom 物件 document node elementnode textnode a...