DOM:document.firstChild
From MDC
Contents |
[edit] Summary
Returns the first node in the list of direct children of the Document.
Note: The returned node is not necessarily the root element of the document; it can also be a processing instruction, for example. If you need the root element, use
document.documentElement.[edit] Syntax
var child = document.firstChild
childis the returnedNode.
[edit] Example
Suppose we have an HTML document. The following statement will alert [object DocumentType] if the document has a DTD, or [object HTMLHtmlElement] if the first node is <html>:
alert(document.firstChild);