All Tech Tips

attribute Object

Represents an attribute or property of an HTML element as an object.

Members Table

AttributePropertyDescription
expando Sets or retrieves a value indicating whether arbitrary variables can be created within the object.
firstChild Retrieves a reference to the first child in the childNodes collection of the object.
lastChild Retrieves a reference to the last child in the childNodes collection of an object.
NAMEname Sets or retrieves the name of the object.
nextSibling Retrieves a reference to the next child of the parent for the object.
nodeName Retrieves the name of a particular type of node.
nodeType Retrieves the type of the requested node.
nodeValue Sets or retrieves the value of a node.
ownerDocument   Sets or retrieves the document object associated with the node.
parentNode Retrieves the parent object in the document hierarchy.
previousSibling Retrieves a reference to the previous child of the parent for the object.
specified Retrieves whether an attribute has been specified.
value   Sets or retrieves the value of the object.
CollectionDescription
attributes Retrieves a collection of attributes of the object.
childNodes Retrieves a collection of HTML Elements and TextNode objects that are direct descendants of the specified object.
MethodDescription
appendChild Appends an element as a child to the object.
cloneNode Copies a reference to the object from the document hierarchy.
hasChildNodes Returns a value that indicates whether the object has children.
insertBefore Inserts an element into the document hierarchy as a child node of a parent object.
removeChild Removes a child node from the object.
replaceChild Replaces an existing child element with a new child element.

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.

This object is available in script as of Internet Explorer 5.

Example

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>

Standards Information

There is no public standard that applies to this object.



Copyright © 2006 alltechtips.com. All rights reserved.

This website and the materials and information you find on this website are provided "as is", without warranty of any kind, either express or implied, including without limitation any warranty for information, services, or products provided through or in connection with the service and any implied warranties of merchantability, fitness for a particular purpose, expectation of privacy or non-infringement.
Advertising
health | home | ip address | golf courses | recipes | flooring | rubber flooring | cd duplication | schools