Programmer's Guide > Interfaces > W3C Element interface > setAttributeNodeNS method
  
setAttributeNodeNS method
Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one.
HTML-only DOM implementations do not need to implement this method.
setAttributeNodeNS(newAttr )
Parameters
AttrnewAttr
The Attr node to add to the attribute list.
Returns
Attr. If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned.
Throws
DOMException
WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.