Chapter 1
JavaScript: The Big Picture
IN THIS CHAPTER
Getting a feel for programming in general, and JavaScript in particular
Checking out the tools you need to get coding
Adding comments to your JavaScript code
Storing your code in a separate JavaScript file
In this chapter, you explore some useful JavaScript basics. Don’t worry if you’ve never programmed before. I take you through everything you need to know, step-by-step, nice and easy. As you’re about to find out, it really is fun to program.
Adding JavaScript Code to a Web Page
Okay, it’s time to roll up your sleeves, crack your knuckles, and start coding. This section describes the standard procedure for constructing and testing a script and takes you through a couple of examples.
The <script> tag
The basic container for a script is, naturally enough, the HTML <script> tag and its associated </script> end tag:
<script> JavaScript statements go here</script>
Where do you put the <script> tag?
With certain exceptions, it doesn’t matter a great deal where you put your <script> tag. Some people place the tag between the ...