O'Reilly logo

JavaScript Testing by Liang Yuxian Eugene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—giving behavior to your HTML document

We are going to apply JavaScript to an HTML document (styled with CSS). In general, the HTML elements and CSS are not changing as compared to the previous example, except that you will see HTML buttons added to the HTML document.

The JavaScript applied to the HTML document in this example is known as inline JavaScript because it exists within the HTML document.

What we are trying to accomplish here is to show you the language features such as how to declare variables, functions, manipulating DOM of the HTML elements, and various methods of referencing HTML elements by their id or class. You will also learn about some of the commonly-used built-in methods of arrays, and elements that are referenced, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required