The objective of this tutorial is:
1. introduce DOM
2. using JavaScript to modify DOM
What is DOM?
Wikipedia give us this definition:
Document Object Model (DOM) is a platform- and language-independent standard object model for representing HTML or XML and related formats.
The keyword here is the object model. To make everything simple, DOM is another way of viewing a document (usually in HTML or XML form). In DOM, the document will be seen as a bunch of parent, children and sibling.
For example:
<html>
<head>
</head>
<body>
</body>
</html>
• Head and body, which included inside html tag considered as the children of html.
• Hence, html has two node children, head and body.
• Head has one sibling node, named body.
It works more or less the same for XML document.