The Essential Guide to HTML5

(Greg DeLong) #1

MAZES


Our application uses a JavaScript alert box to show a message. The user needs to click the OK button to
remove the alert box from the screen.


Figure 7-11 shows the message after a user clicks the Store date info button.


Figure 7-11. After storing date information


If the user later clicks on the Retrieve date info button, hell see a message similar to Figure 7-12.


Figure 7-12. Retrieving the stored date information


You can give your players a way to remove the stored information using a Remove date info button. Figure
7-13 shows the result.


Figure 7-13. After removing stored information


HTML5 lets you save, fetch, and remove a key/value pair, using methods for the built-in object
localStorage.

Free download pdf