Javascript Reference
Categories: attributes

javascript attributes setNamedItem( )

@June 21, 2008, 6:35 p.m.
setNamedItem( ) Firefox/Netscape/NN 6 IE 6 Chrome/Safari/DOM 1  

setNamedItem(attrObjectReference)

  

Inserts a single Attr object into the current collection of attributes. If the destination of the attribute is an existing element, you may also use the setAttributeNode( ) method on the element to insert the Attr object. When the setNamedItem( ) method is invoked, the browser first looks for a match between the new attribute's name and existing attribute names within the collection. If there is a match, the new attribute replaces the original one; otherwise, the new attribute is added to the collection.

 
Parameters
 
attrObjectReference

A reference to an Attr node object created through document.createAttribute( ) or an Attr node from another element in the document tree.

 
Returned Value

Reference to an Attr object either created anew or referenced from elsewhere in the document tree.


Powered by Linode.