Search and Find
Service
Title Page
1
Copyright Page
2
Contents at a Glance
4
Table of Contents
5
About the Author
10
About the Technical Reviewer
11
Acknowledgments
12
Introduction
13
Who is this book for?
13
How is this book structured?
13
Conventions used in this book
14
Layout conventions
14
Chapter 1: The Basics
15
Introduction
15
Critical requirements
17
HTML5, CSS, and JavaScript features
18
Basic HTML structure and tags
18
Using cascading style sheets
22
JavaScript programming
24
Building the application and making it your own
25
Testing and uploading the application
33
Summary
33
Chapter 2: Dice Game
34
Introduction
34
Critical requirements
37
HTML5, CSS, and JavaScript features
37
Pseudo-random processing and mathematical expressions
37
Variables and assignment statements
38
Programmer-defined functions
39
Conditional statements: if and switch
40
Drawing on the canvas
42
Displaying text output using a form
51
Building the application and making it your own
51
Throwing a single die
53
Throwing two dice
60
The complete game of craps
68
Making the application your own
76
Testing and uploading the application
78
Summary
78
Chapter 3: Bouncing Ball
80
Introduction
80
Critical requirements
83
HTML5, CSS, JavaScript features
83
Drawing a ball, image, and gradient
83
Setting up a timing event
89
Calculating a new position and collision detection
91
Validation
92
HTML page reload
93
Building the application and making it your own
93
Testing and uploading the application
109
Summary
109
Chapter 4: Cannonball and Slingshot
110
Introduction
110
Critical requirements
113
HTML5, CSS, and JavaScript features
114
Arrays and programmer-defined objects
114
Rotations and translations for drawing
116
Drawing line segments
120
Mouse events for pulling on the slingshot
121
Changing the list of items displayed using array splice
123
Distance between points
123
Building the application and making it your own
124
Cannonball: with cannon, angle, and speed
131
Slingshot: using a mouse to set parameters of flight
141
Testing and uploading the application
153
Summary
153
Chapter 5: The Memory (aka Concentration) Game
154
Introduction
154
Critical requirements
159
HTML5, CSS, JavaScript features
159
Representing cards
159
Using Date for timing
160
Providing a pause
161
Drawing text
162
Drawing polygons
164
Shuffling cards
165
Implementing clicking on a card
165
Preventing certain types of cheating
166
Building the application and making it your own
167
Testing and uploading the application
189
Summary
190
Chapter 6: Quiz
191
Introduction
191
Critical requirements
195
HTML5, CSS, and JavaScript features
196
Storing and retrieving information in arrays
196
Creating HTML during program execution
198
Changing elements by modifying CSS using JavaScript code
201
Text feedback using form and input elements
202
Presenting video
203
Building the application and making it your own
205
Testing and uploading the application
222
Summary
222
Chapter 7: Mazes
224
Introduction
224
Critical requirements
229
HTML5, CSS, and JavaScript features
230
Representation of walls and the token
230
Mouse events to build and position a wall
230
Detecting the arrow keys
231
Collision detection: token and any wall
233
Using local storage
235
Encoding data for local storage
241
Radio buttons
242
Building the application and making it your own
243
Creating the second maze application
257
Testing and uploading application
268
Summary
268
Chapter 8: Rock, Paper, Scissors
270
Introduction
270
Critical requirements
273
HTML5, CSS, and JavaScript features
274
Providing graphical buttons for the player
274
Generating the computer move
278
Displaying results using animation
281
Audio and DOM processing
283
Starting off
285
Building the application and making it your own
286
Testing and uploading the application
295
Summary
296
Chapter 9: Hangman
297
Introduction
297
Critical requirements
305
HTML5, CSS, JavaScript features
305
Storing a word list as an array defined in an external script file
305
Generating and positioning HTML markup, then making the markup be buttons, and then disabling the buttons
306
Creating progressive drawings on a canvas
308
Maintaining the game state and determining a win or loss
310
Checking a guess and revealing letters in the secret word by setting textContent
311
Building the application and making it your own
312
Testing and uploading the application
325
Summary
325
Chapter 10: Blackjack
327
Introduction
327
Critical requirements
332
HTML5, CSS, and JavaScript features
333
Source for images for card faces and setting up the Image objects
333
Creating the programmer-defined object for the cards
334
Dealing the cards
334
Shuffling the deck
337
Capturing key presses
338
Using header and footer element types
340
Building the application and making it your own
340
Testing and uploading the application
356
Summary
356
Index
357
All prices incl. VAT