In previous game, we have leant some new properties of HTML 5.
In this version, we learn some new function in javascript below:
- to generate a random number from 1 to 100: Math.floor(Math.random() * 100);
- to catch the event keydown in all over the site: window.addEventListener("keydown", keydownHandler, false);
- to remove event Handler when we don't want that element (ex: button) catch an event: button.removeEventListener("click",...
Browse » Home » Archives for 2019
HTML5 - Guessing number game
In this game, we will familiar with properties placeholder of HTML 5 and javascript function querySelector instead of selectElementById in previous version.
<!doctype html>
<title>Number guessing game</title>
<p id="output">I am thinking of a number between 0 and 99.</p>
<input id="input" type="text" placeholder="Enter your guess...">
<button>guess</button>
<script type="text/javascript">
//Game...
Beat monster game by HTML5

From last article about animation, today we move to the game beat monster.
In this game, we create a map as matrix 4x4. Then, each time users click or mouse over monster, we change its location. If user click on head of monster, he ore she get one point. In this game, we learn how to make sound every click of user.
First of all, check over...
Subscribe to:
Posts (Atom)