Table of Contents
The <script> Tag
- In HTML, JS codes are inserted between <script> and </script> tags.
JS Functions and Events
- JS can be placed in the <body>, or in the <head> section of an HTML page, or in both.
- The function is invoked (called) when a button is clicked.
Note :- Placing scripts at the bottom of the <body> element improves the display speed, because script interpretation slows down the display.
- Scripts can also be placed in external files.
- You can place an external script reference in <head> or <body> as you like.
- The script will behave as if it was located exactly where the <script> tag is located.
- External scripts cannot contain <script> tags.
- It separates HTML and Java code.