亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

XML DOM removeAttributeNode() 方法

定義和用法

removeAttributeNode() 方法從元素中刪除指定的屬性節(jié)點。

語法:

elementNode.removeAttributeNode(node)
參數(shù) 描述
node 必需。要刪除的節(jié)點。

返回值

刪除的 Attr 節(jié)點。

說明

該方法從當(dāng)前元素的屬性集合中刪除(并返回)一個 Attr 節(jié)點。如果 DTD 給刪除的屬性設(shè)置了默認(rèn)值,那么該方法將添加一個新的 Attr 節(jié)點,表示這個默認(rèn)值。用 removeAttribute() 方法代替該方法往往會更簡單。

實例

在所有的例子中,我們將使用 XML 文件 books.xml,以及 JavaScript 函數(shù) loadXMLDoc()。

下面代碼片段從 "books.xml" 中的所有 <book> 元素中刪除 "category" 屬性:

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName('book');

for(i=0;i<x.length;i++)
{
attnode=x.item(i).getAttributeNode("category");
old_att=x.item(i).removeAttributeNode(attnode);
document.write("Removed attribute: " + old_att.name + "<br />");
}

輸出:

Removed attribute: category
Removed attribute: category
Removed attribute: category
Removed attribute: category