attributes

< dom
Jump to: navigation, search



Inherits from Node

Properties

No properties.

Methods

API Name Summary
getNamedItem Gets an attribute with a given name from an element.
getNamedItemNS Gets an attribute with a given name and a given namespace.
removeNamedItem Removes an attribute with a given name.
removeNamedItemNS Removes an attribute with a given name and a given namespace.
setNamedItem
setNamedItemNS


Events

No events.

Inherited from Node

Properties

API Name Summary
attributes Associatve array containing the attributes of node.
childNodes
firstChild
lastChild
localName Retrieves the local name of the fully qualified XML declaration for a node.
namespaceURI Retrieves the namespace URI of the fully qualified XML declaration for a node.
nextSibling Retrieves the next child node of the parent of the node.
nodeName Gets the name of a particular type of node.
nodeType Retrieves the type of the requested node.
nodeValue Gets or sets the value of a node.
ownerDocument
parentNode Retrieves the parent node in the document hierarchy.
prefix Sets or retrieves the prefix of the fully qualified XML declaration for a node.
previousSibling Retrieves the previous child node of the parent of the node.
textContent Sets or retrieves the text content of a node and any child nodes.

Methods

API Name Summary
appendChild Appends an element as a child to the object.
cloneNode Copies a reference to the object from the document hierarchy.
compareDocumentPosition Compares the position of two nodes in a document.
empty
hasAttributes
hasChildNodes
insertBefore Inserts a node into the document hierarchy as a child node of a node.
isDefaultNamespace Indicates whether or not a namespace is the default namespace for a document.
isEqualNode Determines whether two nodes are equal in their type, name and namespace.
isSameNode Determines if two nodes are the same node.
isSupported Returns a value indicating whether or not the object supports a specific DOM standard.
lookupNamespaceURI Gets the URI of the namespace associated with a namespace prefix, if any.
lookupPrefix Gets the namespace prefix associated with a URI, if any.
normalize Merges adjacent DOM objects to produce a normalized document object model.
removeChild Removes a child node from a node.
removeNode Non standard. Proprietary. Use removeChild instead. Removes a node from the document hierarchy.
replaceChild Replaces an existing child node with a new child node.
replaceNode Non standard. Proprietary. Replaces the node with another node.
swapNode Non standard. Proprietary. Exchanges the location of two nodes in the document hierarchy.

Events

No events.

Examples

This example uses the attribute object to create a list of attributes that are specified.

<SCRIPT>
function fnFind(){
   for(var i=0;i<oList.attributes.length;i++){
      if(oList.attributes[i].specified){
         alert(oList.attributes[i].nodeName + " = "
          + oList.attributes[i].nodeValue);
      }
   }
}
</SCRIPT>
<UL onclick="fnFind()">
<LI ID = "oList" ACCESSKEY = "L">List Item 1
</UL>

Notes

Remarks

The attribute object is accessible through the attributes collection. A valid attribute or property can be any Dynamic HTML (DHTML) property or event that applies to the object, or an expando. When displaying a Web page in IE8 Standards mode, Windows Internet Explorer distinguishes between attribute values specified by the original page author and the representation of those values in the DOM. For more information, see Attribute Differences in Internet Explorer 8. This object is available in script as of Microsoft Internet Explorer 5.

Standards information

There are no standards that apply here.

Members

The attribute object has these types of members:

  • [#methods Methods]
  • [#properties Properties]


Methods

The attribute object has these methods. {

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]