HTML and CSS Reference
Unlike the <img> element, <script> is not a void element and therefore you always have to specify both start
and end tags.
1. Create a new file in your text editor.
4. Save the example10-2.js file.
5. Now add a src attribute to the <script> element and set its value to example
6. Save this file as example10-2.html .
Load the HTML file in your browser; you should see that the Hello World! text is still displayed onscreen. Try
To ensure that your web pages load fast, it's best to always put your <script> elements at the end of your HTML
file, just before the </body> tag.
ables, functions, event listeners, control structures, and loops. These are key programing concepts that will give you
A Simple Program
You've already encountered the standard Hello World! program, so let's skip ahead to something a little more inter-
active. The following program asks users for their names and then displays the input on the screen:
1. Create a new file in your text editor called example10-3.js .