Availability
DOM Level 1 Core
Synopsis
Node setNamedItem(Node arg)throws DOMException;
Arguments
arg
The node to be added to the NamedNodeMap.
Returns
The node that was replaced, or null if no node was
replaced.
Throws
This method may throw a DOMException with one of the following
code values:
HIERARCHY_REQUEST_ERR
arg is a node of a type that is not
suitable for this NamedNodeMap (e.g., is not an Attr node).
INUSE_ATTRIBUTE_ERR
arg is an Attr node that is already
associated with an element.
NO_MODIFICATION_ALLOWED_ERR
The NamedNodeMap is read-only. WRONG_DOCUMENT_ERR
arg has a different
ownerDocument than the document from which the
NamedNodeMap was created.
Description
setNamedItem( ) adds the specified node to a
NamedNodeMap and allows it to be looked up using the value of the
node's nodeName property. If the
NamedNodeMap already contains a node with that name, that node is
replaced and becomes the return value of the method.
See Also
Element.setAttribute( )
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.