Chapter 6. Quiz

Quiz
  • creating HTML by code

  • positioning and repositioning HTML elements

  • responding to clicks of the mouse

  • arrays of arrays

  • playing video

Introduction

This chapter demonstrates how HTML elements can be created dynamically and then positioned and repositioned on the screen. This is in contrast not only to drawing on a canvas element but also to the old way of creating static web pages. Our goal is to produce a quiz in which the player must match the names of countries and capital cities. We will use an array of arrays to hold the necessary information and build on the game to give more feedback to the player, including playing a video clip as ...

Get The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.