<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
window.onload = function() {
var input = document.getElementsByTagName("input")[0];
input.value = "";
input.onkeydown = function() {
alert(1);
};
input.onkeypress = function() {
alert(2);
};
input.onkeyup = function() {
alert(3);
};
};
</script>
</head>
<body>
<p><input></p>
</body>
</html>