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

XML DOM setAttributeNS() 方法


Element 對(duì)象參考手冊(cè) Element 對(duì)象

定義和用法

setAttributeNS() 方法添加新的屬性(帶有命名空間)。

如果元素中已經(jīng)存在指定名稱的屬性或命名空間,它的值更改為前綴和 value 參數(shù)的值。

語法

elementNode.setAttributeNS(ns,name,value)
參數(shù) 描述
ns 必需。規(guī)定要設(shè)置的屬性的命名空間 URI。
name 必需。規(guī)定要設(shè)置的屬性的名稱。
value 必需。規(guī)定要設(shè)置的屬性的值。

實(shí)例 1

實(shí)例

xmlDoc=loadXMLDoc("books_ns.xml"); x=xmlDoc.getElementsByTagName("book")[0]; ns="/w3cnote/"; x.setAttributeNS(ns,"edition","first"); document.write(x.getAttributeNS(ns,"edition"));

輸出:

first

運(yùn)行代碼 ?

實(shí)例 2

實(shí)例

xmlDoc=loadXMLDoc("books_ns.xml"); x=xmlDoc.getElementsByTagName("title")[0]; ns="/w3cnote/"; x.setAttributeNS(ns,"c:lang","italian"); document.write(x.getAttributeNS(ns,"lang"));

輸出:

italian

運(yùn)行代碼 ?

Element 對(duì)象參考手冊(cè) Element 對(duì)象其他擴(kuò)展