chapter ten

Introducing JavaScript

UP TO THIS point in the book, you focused on how to create web pages using HTML. In the remaining chapters, you are going to be using JavaScript and HTML5 to create interactive features for your Joe’s Pizza Co. website. But first, you need to get up to speed about the JavaScript programming language.

The JavaScript programming language is a very large topic, possibly even bigger than HTML and CSS combined. In this chapter I introduce you to the basic concepts of JavaScript so that you can build a foundation on which to enhance your JavaScript knowledge in the future. You will step away from the Joe’s Pizza Co. website for a while, and focus instead on building a number of small JavaScript programs. As you progress through each of these exercises you will learn about the key concepts of programming. In the following chapters, you’ll return to the Joe’s Pizza Co. website and put your new knowledge to use.

You’ll start by learning how to add JavaScript to your web pages, by either putting the code inline with your existing HTML or in separate JavaScript files. You will learn how to write your own programs in JavaScript, how JavaScript programs are constructed, and the various tools available to you as a developer. These include control and loop structures as well as how to select and manipulate elements within your pages.

You’ll also look at the Document Object Model (DOM), what it is, how it is created, and why it is important. You will also ...

Get HTML5 Foundations now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.