Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Adds an attribute to an element using an attributes collection.
Syntax
newretNode = attributes.setNamedItem( oNamedItem )Parameters
oNamedItem | Required. An attribute . |
Return Value
Returns the previously existing attribute if it has the same name as the new attribute , otherwise null.
Remarks
An attribute that is set with this method does not have to apply to the element.
If an attribute with the same name is already present, it is replaced by the new attribute .
Example
The following example shows how to add an attribute to an element using the setNamedItem method.
<HTML>
Standards Information
This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To
|
attributes |
Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |