July 12, 2001 - Creating Document's Attributes | WebReference

July 12, 2001 - Creating Document's Attributes

Yehuda Shiran July 12, 2001
Creating Document's Attributes
Tips: July 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

The DOM on Internet Explorer 6 lets you create attributes at the document level, on the fly. You would go:

document.createAttribute("foo");

for example, and out you will get a new attribute object. The value of the attribute is an empty string. Its name will be "foo" in this example.

The code in this tip can be viewed only by Netscape 6 and Internet Explorer 6.

Learn more about the DOM in Columns 40, The DOM, Part I: Analysis, through Column 47, A DOM-Based Snakes Game, Part II.