Javascript Reference
Categories: Element

javascript Element setAttributeNodeNS( )

@July 11, 2008, 2:12 p.m.
setAttributeNodeNS( ) Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 2

setAttributeNodeNS(attrObjectReference)

 

Inserts or replaces an attribute in the current element. The parameter is a reference to an Attr node object that is either created anew or references from another element in the document tree. When the setAttributeNodeNS( ) method is invoked, the browser first looks for a match between the new attribute's pairing of local name and namespace URI and existing attribute local names and namespace URIs. If there is a match, the new attribute replaces the original one; otherwise, the new attribute is added to the attributes of the element. Adding an attribute node does not change the source code when viewed through the browser, but may affect how the browser renders the element if the attribute affects the visual representation of the element. The value of the new attribute may be retrieved via the getAttributeNS( ) method.

 
Parameters
 
 
Returned Value

Reference to a replaced Attr object (which is no longer part of the document tree) or null for an insertion.


Powered by Linode.