Skip to main content
Top

2010 | OriginalPaper | Chapter

Quiz

Author : Jeannie Meyer

Published in: The Essential Guide to HTML5

Publisher: Apress

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

In this chapter, we implemented a simple quiz that asked a player to match the names of countries and capitals. The application used the following programming techniques and HTML5 features:

creating HTML during runtime using document.createElement, document.getElementById, and document.body.appendChild

setting up event handling for the mouse click event using addEventListener

changing color of objects on the screen using code to change CSS settings

an array of arrays to hold the quiz content

for loops for iterating over the array

do-while loops to make a random choice of an unused question set

substring for determining a correct match

video and source elements for displaying video encoded in formats acceptable by different browsers

You can make use of dynamically created and repositioned HTML along with the drawing on canvas that you learned in the previous chapters. The implementation of Hangman, described in Chapter 9, does just that. You can use video as a small part of an application, as was done here, or as the major part of a web site. In the next chapter we return to drawing on canvas as we build a maze and then travel through it.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Metadata
Title
Quiz
Author
Jeannie Meyer
Copyright Year
2010
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4302-3384-8_6

Premium Partner