DOM Basics in JavaScript

In the previous lessons, we studied the basic features of the JavaScript language. Starting with this lesson, we will do what JavaScript itself is intended for - we will change the elements of the HTML page and respond to user actions. Our scripts will become more spectacular and useful.

In all of the following tutorials, your JavaScript code must be placed below the HTML code it refers to. That is, the structure of your code should look like this:

<!DOCTYPE html> <html> <head> </head> <body> your html tags <script> your JavaScript code </script> </body> </html>

Or as follows, if you write JavaScript code in a separate file:

<!DOCTYPE html> <html> <head> </head> <body> your html tags <script src="index.js"></script> </body> </html>

In the future, for brevity, I will not give the full code, but I will simply indicate what needs to be written in the HTML part, and what - in the JavaScript part.

Make a file with the specified code structure.