www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
 attribute Object
attribute Object

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

Members Table

The following table lists the members exposed by the attribute object.

Attributes/Properties
Show:
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 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 Gets whether an attribute has been specified.
value Sets or gets 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 Microsoft 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 >
<LI ID = "oList" ACCESSKEY = "L">List Item 1
</UL>

Standards Information

There is no public standard that applies to this object.

Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG