Access Relative Nodes Back
<html>
<head>
<title>DOM Example</title>
</head>
<body>
<p>Hello World!</p>
<p>Isn't this exciting?</p>
<p>You're learning to use the DOM!</p>
</body>
</html>
- access
<html />
var objHtml = this.document.documentElement;
- access
<head />
or<body />
var objHead = objHtml.firstChild;
var objBody = objHtml.lastChild;
var objHead = objHtml.childNodes.item(0); // objHtml.childNodes[0]
var objBody = objHtml.childNodes.item(1); // objHtml.childNodes[1]
var objHead = this.document.head;
var objBody = this.document.body;