Why Use HTML Scripting?
Inline scripts are written directly within the HTML document using the tags. Here’s an example:
<p>Hello World!</p> <script> var greeting = "Hello!"; var name = "John Doe"; alert(greeting + " " + name); </script>
In this example, a simple greeting message pops up with an alert box when the page loads.
External Script Files
<p>Hello World!</p> <script src="script.js"></script>