中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

HTML DOM createAttribute() 方法

Document 對象 參考手冊 Document 對象

實例

創(chuàng)建 class 屬性, 屬性值為 "democlass", 并將clas屬性添加到 H1 元素中:

var att=document.createAttribute("class");
att.value="democlass";
document.getElementsByTagName("H1")[0].setAttributeNode(att);

元素添加屬性前:

Hello World

元素添加屬性后:

Hello World


運行代碼 ?

定義和用法

createAttribute()方法用于創(chuàng)建一個指定名稱的屬性,并返回Attr 對象屬性。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 createAttribute() 方法


語法

document.createAttribute(attributename)

參數(shù)

參數(shù) 類型 描述
attributename Attr object 必須。要創(chuàng)建的屬性名稱。

返回值

類型 描述
節(jié)點對象 創(chuàng)建的屬性

技術細節(jié)

DOM 版本 Core Level 1 Document 對象

Document 對象 參考手冊 Document 對象

其他擴展