A McGraw-Hill Book HTML5 for iOS and Android
By Robin Nixon (McGraw-Hill 2011, ISBN 978-0071756334)

Home | About | Buy It | Download Examples | Errata | (Ahora en español!/Amazon EE.UU.)

Chapter: 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

Chapter 6: Using JavaScript with HTML5

The great thing about JavaScript is that it could have been designed purely as a stand alone scripting language and it would still have been very useful. But the developers did something that would help form the future of the web, which was to link it to the HTML Document Object Model (DOM).
     Whenever you see something dynamic happening on a web page such as an image popping up when you pass the mouse over a link, graphic images zooming out when you click them, or menus altering according to your selections, this is usually accomplished using JavaScript.
     With it you can do almost anything you like with a web page, such as easily adding new paragraphs, changing focus and selecting text, replacing images, playing sound effects, music and videos, and much more. And when you add CSS to the mixture you can dynamically apply style changes to a page completely changing the way it looks, without altering the HTML.

Examples from this chapter:

Most examples in this book require the latest version of any of Microsoft Internet Explorer, Google Chrome, Mozilla Firefox, Apple Safari, Opera, iOS or Android in order to work correctly. To see how the examples work use your browser's View Source feature, or download the examples file, unzip the contents and examine the files in a text editor.