- What is a function?
- Pre-defined functions
- Scope of Variables
- Function Expressions
- Anonymous Functions
- Callback Functions
- What is an object?
- Accessing Object Properties
- Calling an Object’s Methods
- Altering Properties/Methods
Array Properties and Methods
- The length property
- Stack Methods
- Queue Methods
- Reordering Methods
- Manipulation Methods
- Location Methods
- Iterative Methods
- Working with array of objects
- The Document Object Model
- Node Relationships
- Working with the Contents of Elements
- Getting Elements by ID, Tag Name, or Class
- Adding and removing element
Handling Input and Output
Ajax and JSON
The Document Object Model or DOM is the representation of the objects that make up the structure of a document on the web. The Document Object Model is an application programming interface (API) for manipulating HTML documents.
Understanding the DOM is the key to being able to manipulate the text or HTML in a web page. Using the DOM, you can create animations, update data without refreshing web pages, move objects around in a browser, and much more.
A DOM tree is made up of individual components, called nodes. The main node, from which every other node springs, is called the document node. The node under the document node is the root element node. For HTML documents, the root node is HTML. After the root node, every element, attribute, and a piece of content in the document is represented by a node in the tree that comes from another node in the tree.
The DOM has several different types of nodes:
- Document node: The entire HTML document is represented in this node
- Element nodes: The HTML elements
- Attribute nodes: The Attributes associated with elements
- Text nodes: The text content of elements
- Comment nodes: The HTML comments in a document
Listing 10-1 is the markup for a web page. The DOM representation is shown in the next figure