You can add an inline script at any place within an HTML document, but most web developers like to place the scripts in three locations.
You have already seen examples of online scripts in exercise 1, exercise 2 and exercise 3.
Step 1: Create a folder called “Exercise-04” on your Windows desktop.
Step 2: Open the folder, “Exercise-04” and create a text file and save it as “main.js“.
<h1>" + "This is another
document.write("This is paragraph one!");
document.write("This is paragraph two!");
document.write("This is paragraph three!");
Step 4: Close the file.
Step 1: Create a new text document called “ex04.txt” in the Exercise-04 folder on your Windows desktop.
Step 2: Open the text file and insert the following code and save the file as “ex04.html” in the same location.
<p> THIS IS TEST FOR EXTERNAL JAVA SCRIPT.CLICK ANYWHERE ON THE PAGE</p>
Step 4: Save and close the file.
The final html page should look like the following.
Output to the Browser
onload = "message()">