programming-examples/html/Basics/06-keyboard-events (Basic Javascript Animation).html
2019-11-18 14:44:36 +01:00

27 lines
702 B
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Keyboard Events</title>
<link rel="stylesheet" href="../include/style.css">
</head>
<body>
<header>
Example from <a href="http://amzn.com/1430236655?tag=html5anim-20"><em>Foundation HTML5 Animation with JavaScript</em></a>
</header>
<aside>Open debugging console in web browser and press key.</aside>
<script>
window.onload = function () {
function onKeyboardEvent (event) {
console.log(event.type);
}
window.addEventListener('keydown', onKeyboardEvent, false);
window.addEventListener('keyup', onKeyboardEvent, false);
};
</script>
</body>
</html>