Week 8 - Session 1 - JavaScript in the Browser
blog image source |
The global binding document gives us access to these objects. Its documentElement property refers to the object representing the <html> tag. Since every HTML document has a head and a body, it also has head and body properties, pointing at those elements.
When a web page is loaded, the browser creates a Document Object Model of the page, which is an object oriented representation of an HTML document, that acts as an interface between JavaScript and the document itself and allows the creation of dynamic web pages:
- JavaScript can add, change, and remove all of the HTML elements and attributes in the page.
- JavaScript can change all of the CSS styles on the page.
- JavaScript can react to all of the existing events in the page.
- JavaScript can create new events on the page.
Document Object Model - https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction
Document - https://developer.mozilla.org/en-US/docs/Web/API/Document