asp.net.ph

Skip Navigation Links

attributes Collection

DHTML Collections


DOM Level 1 Specification.

Retrieves a collection containing all the supported attributes of a given object.

Syntax


[ collattributes = ] object.attributes
[ oObject = ] object.attributes ( iIndex )

Possible Values


collattributes Reference to a zero based array of attributes applied to the object.
oObject Reference to an individual attribute in the array of attributes assigned to the object.
iIndex Required. Number specifying the attribute to retrieve.

Members



Remarks

This collection does not include custom attributes assigned in script.

Example

The following example shows how the attributes collection is used to iterate through all the supported attributes of a specified object, in this case the document BODY.

NOTE: The function returns a list of the attribute names, whether the attribute was explicitly specified or not in HTML or in script.

<script language="JavaScript">
<!--
function getAttribs ( ) {
   var attribs = document.body.attributes;
   var atts = "The BODY element has the following attributes:\n\n";
   for ( a = 0; a < attribs.length; a ++ )
      atts += attribs [ a ].nodeName + ", ";
   alert ( atts.substring ( 0, atts.length - 2 ) );
}
//-->
</script>

 Show me 

See Also

Attribute Object



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note