TOC PREV NEXT INDEX

domref



createElement


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.

Syntax

element = element.createElement(type)
 

Parameters

element is an object.

type is a string that represents the type of element to be created.

Example

div = document.createElement("div");
 
preface = document.getElementById("preface");
 
document.insertBefore(div, preface);
 

Notes

In addition, if there are known attributes with default values, attribute nodes representing them are automatically created and attached to the element.

To create an element with a qualified name and namespace URI, use the createElementNS method.

Specification

createElement


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