ABSTRACT

JavaScript was invented primarily to support buttons, forms, and the like, but one should need a bit more background before exploring them. Still, we can do a surprising number of useful things simply by playing with the content of pages. To see the JavaScript in action, run a browser, open its developer tools so that one can see the JavaScript console, and then load the page. the Document Object Model (DOM) is organized as a tree: each element or piece of text is a node in the tree, and a node’s children are the elements contained within it. Any time the browser detects a change to the Document Object Model, it automatically refreshes just as much of its display as it needs to. one can insert or remove text, change elements’ styles, or copy in entire sub-pages: each time, the browser will do only the work required to reflect that change as quickly as possible.