ZVON > References > DOM2 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.

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 with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.

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

Note:  
If there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element.


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