blob: ea9b800a32b8860960ff39a94bb9eb22133a655b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<html>
<head>
<script type="text/javascript">
window.onload = function() {
document.getElementById('test').addEventListener('keypress', function(e) {
out = document.getElementById('out');
out.innerHTML = 'keyCode: ' + e.keyCode + ' (should be 13)';
if (e.keyCode == 13)
out.style.background = '#6f6';
else
out.style.background = '#f66';
}, false);
document.getElementById('test').focus()
};
</script>
</head>
<body>
<p>Press the numpad Enter key while the input box below is focused:</p>
<p><input type="text" id="test" /></p>
<p id="out"></p>
</body>
</html>
|