June 2025
Beginner
817 pages
31h 30m
English
You can use the script element to embed or reference scripts (e.g., JavaScript) in an HTML document. You can either write the script directly between <script> and </script>, or reference an external script via the src attribute, the meaning of which is described in Table 3.6. However, if you want to reference an external script using the src attribute, the space between the <script> start tag and the </script> end tag must be left empty. Unlike the other elements presented here for the head data of an HTML document, you can use the script element both in the head section and (multiple times) in the document body.
Here’s a simple example of the script element, where a simple JavaScript dialog ...
Read now
Unlock full access