Cameron Dane

HTML5, JavaScript, and jQuery 24-Hour Trainer


Скачать книгу

a good choice for Linux. You may also choose to use an Integrated Development Environment (IDE) such as Eclipse.

      The Chrome web browser has been chosen for this book not so much for the capabilities of the browser itself, but for the developer tools that accompany it. You can choose to use an alternative web browser if you wish, but the examples will focus on Chrome.

      The Chrome web browser is subject to frequent updates, and it is assumed that you will use the latest version of the browser.

      In later sections of this book, you will also need a web server. A lesson is provided to guide you through the process of installing and configuring a web server.

      The source code for the samples is available for download from the Wrox website at:

      www.wrox.com/go/html5jsjquery24hr

      Conventions

      To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

      Warning

      Warnings hold important, not-to-be-forgotten information that is directly relevant to the surrounding text.

      Note

      Notes indicate notes, tips, hints, tricks, or asides to the current discussion.

      As for styles in the text:

      ● We highlight new terms and important words when we introduce them.

      ● We show keyboard strokes like this: Ctrl+A.

      ● We show filenames, URLs, and code within the text like so: persistence.properties.

      ● We present code in two different ways:

      We use a monofont type with no highlighting for most code examples.

      We use bold to emphasize code that is particularly important in the present context or to show changes from a previous code snippet.

      Source Code

      As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wrox.com. For this book, the code download is on the Download Code tab at:

      www.wrox.com/go/html5jsjquery24hr

      You can also search for the book at www.wrox.com by ISBN (the ISBN for this book is 978-1-1190-0116-4) to find the code. A complete list of code downloads for all current Wrox books is available at www.wrox.com/dynamic/books/download.aspx.

      Most of the code on www.wrox.com is compressed in a .ZIP or .RAR archive, or a similar archive format appropriate to the platform. Once you download the code, just decompress it with an appropriate compression tool.

      Errata

      We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time, you will be helping us provide even higher quality information.

      To find the errata page for this book, go to

      www.wrox.com/go/html5jsjquery24hr and click the Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors.

      If you don't spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

      p2p.wrox.com

      For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to email you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

      At http://p2p.wrox.com, you will find a number of different forums that will help you, not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

      1. Go to http://p2p.wrox.com and click the Register link.

      2. Read the terms of use and click Agree.

      3. Complete the required information to join, as well as any optional information you wish to provide, and click Submit.

      4. You will receive an email with information describing how to verify your account and complete the joining process.

      Note

      You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.

      Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum emailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

      For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

      Part I

      HTML and CSS

Lesson 1

      Introduction to HTML5

      This lesson is an introduction to the HTML5 markup language. The HTML5 markup language is a language for structuring and expressing the content of a web page in a manner that can be consistently interpreted by a web browser.

      If you are already familiar with HTML, much of this chapter will look very familiar. It is still important that you read through this lesson, however, because there are a number of important changes in HTML5, and many of these are very subtle.

      If you are not familiar with HTML, or have only a passing familiarity, this lesson will provide you with the background you need to understand the basics of an HTML web page. This lesson is only an introduction, however; the material in this lesson will be enhanced in the remainder of this section.

      What Is a Markup Language?

      A markup language is a language for annotating a document with a set of tags. These tags are used to provide additional meaning and structure to the text of the document, or provide instructions on the manner in which it should be displayed to the reader.

      For instance, a tag may state that one portion of the text is a header, while another portion is a paragraph of text. Consider the following document fragment:

      In this example, the tags can be clearly differentiated from the content of the document by the angle brackets. The following represents the start of a heading:

      while