TOC PREV NEXT INDEX

domref



createAttribute


createAttribute creates a new attribute on the current element.

Syntax

attribute = element.createAttribute(name)
 

Parameters

attribute is an attribute node.

name is a string containing the name of the attribute.

Example

d = document.getElementById("div1);
 
p = d.createAttribute("proportion");
 
p.value = "100";
 

Notes

The return is a node of type attribute. Once you have this node you can, as in the foregoing example, set its value with the value property. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.

Specification

createAttribute


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX