Required.
String that specifies the name of the attribute.
vValue
Required.
Variant that specifies the string, number, or Boolean to assign to the attribute.
iFlags
Optional.
Integer that specifies one the following flags:
0
When the attribute is set, it overwrites any attributes with the same name, regardless of their case.
1
Default. The case of the attribute that you set is respected when it is set on the object.
Return Value
No return value.
Remarks
If the specified attribute is not already present, the setAttribute method adds the attribute to the object and sets the value.
Be careful when spelling attribute names. If you set iFlags
to 1 and the sName
parameter does not have the same uppercase and lowercase letters as the attribute, a new attribute is created for the object.
If two or more attributes have the same name, differing only in case, and iFlags
is set to 0, this method assigns values only to the first attribute created with this name. All other attributes of the same name are ignored.
When setting the CLASS attribute using this method, set the sName
to be "className", which is the corresponding Dynamic HTML (DHTML) property.
Standards Information
method is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .