Element: removeAttributeNS() 方法
Element 介面的 removeAttributeNS() 方法會移除元素上指定名稱空間中指定的屬性。
如果您正在處理 HTML,並且不需要將請求的屬性指定為特定名稱空間的一部分,請改用 removeAttribute() 方法。
語法
js
removeAttributeNS(namespace, attrName)
引數
返回值
無(undefined)。
示例
js
// Given:
// <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
// special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// Now: <div id="div1" width="200px" />
規範
| 規範 |
|---|
| DOM # ref-for-dom-element-removeattributens① |
瀏覽器相容性
載入中…