ZVON > References > DOM1 Reference

createElement (method)

Owning interface and usage:  
Document.createElement(tagName)

Member of these other interfaces :  
none

Description:  
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object. In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element.

Parameters:  
DOMString tagName  -  The name of the element type to instantiate. (Remember that for XML this is case-sensitive.)

Returns:  
Element -  A new Element object.

Exceptions:  
DOMException INVALID_CHARACTER_ERR
Raised if the specified name contains an invalid character.


Example:
JavaScript:
  var elem = document.createElement('P');
  var output = elem.nodeName;
Output:
desired your browser
P