Javascript has three important components, namely ECMAScript, DOM and BOM.
ECMAScript is the core of the language defined by the ECMA specification. In fact, the language itself does not contain input and output definitions. The ECMA specification defines only the basis of this language, and a more complete scripting language can be built on this basis. Our common web browser is just one of the possible host environments for ECMAScript implementation.
DOM, the Document Object Model, is an application programming interface for XML but extended for HTML. DOM maps the entire page into a multi-layer node structure. Each component in an HTML or XML page is a node of some type, and these nodes contain different types of data.
BOM, the Browser Object Model, provides a series of objects and APIs that can operate the browser.
There are two ways to apply javascript code to the page.
Method 1: Insert javascript code into the