Gains and summary of learning js today:
When is the script executed:
1. Execute the script when the page is opened
When the browser opens an HTML document, it The entire document is explained from scratch, including HTML tags and scripts. If there are statements in the script that can be executed directly, they will be interpreted and executed immediately when encountered. For example:
2. Use the ONLOAD event to execute the script
The onload event occurs when a page is opened in the browser. This method is often used when opening a page. At the same time, some messages are displayed to the user.