Availability: |
| |||||||
Property/method value type: | undefined | |||||||
JavaScript syntax: | - | myElement.setAttribute(anAttribName, aValue) | ||||||
- | myElement.setAttribute(anAttribName, aValue, aCaseSense) | |||||||
Argument list: | aCaseSense | A flag indicating whether name lookup is case sensitive | ||||||
anAttribName | An attribute of an Element object | |||||||
aValue | A new value for the custom attribute |
An attribute is added to the attributes collection for the object. Some attributes are presented as properties as well which is simply an alternative means of access to the same value. If that is the case then setting the attribute will also alter the property setting as well.
If the case sensitivity flag is set to true, then the name of the attribute must exactly match the name used in the HTML tag attribute, otherwise the results are uncertain.
Prev | Home | Next |
Element.scrollWidth | Up | Element.setAttributeNode() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |