-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathkeys.htm
More file actions
42 lines (33 loc) · 846 Bytes
/
Copy pathkeys.htm
File metadata and controls
42 lines (33 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<title>Key Event Test</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(function(){
$(document).keydown(function(e){
log('keydown', e);
}).keyup(function(e){
log('keyup', e);
}).keypress(function(e){
log('keypress', e);
});
});
function log(msg, e){
var str = msg+' keyCode='+e.keyCode;
if (e.altKey) str += ' [alt]';
if (e.ctrlKey) str += ' [ctrl]';
if (e.metaKey) str += ' [meta]';
if (e.shiftKey) str += ' [shift]';
if (e.originalEvent.altKey) str += ' [o-alt]';
if (e.originalEvent.ctrlKey) str += ' [o-ctrl]';
if (e.originalEvent.metaKey) str += ' [o-meta]';
if (e.originalEvent.shiftKey) str += ' [o-shift]';
var d = $('<div/>').text(str);
$('#log').append(d);
}
</script>
</head>
<body>
<div id="log"></div>
</body>
</html>