name property (attribute)
Returns the name of the current attribute.
To get the value of an attribute use the value property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
String that represents the name.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the name property:
|
||||
<head> <script type="text/javascript"> function GetInfoAttrs () { var info = document.getElementById ("info"); var message = ""; for (var i = 0; i < info.attributes.length; i++) { var attr = info.attributes[i]; if (attr.specified) { message += attr.name + " = " + attr.value + "<br/>"; } } info.innerHTML = "The following attributes are specified for this element:<br />" + message; } </script> </head> <body onload="GetInfoAttrs ()"> <div id="info" style="width:500px; height:300px; overflow:auto; background-color:#e0d0d0;"></div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments