| 1 |
<html> |
| 2 |
<head> |
| 3 |
<script src="jquery-1.4.2.js"></script> |
| 4 |
</head> |
| 5 |
|
| 6 |
<body> |
| 7 |
<h1>KeyDown.</h1> |
| 8 |
currentTarget: <input id="kd_currentTarget"><br/> |
| 9 |
which: <input id="kd_which"></br> |
| 10 |
shiftKey: <input id="kd_shiftKey"><br/> |
| 11 |
ctrlKey: <input id="kd_ctrlKey"><br/> |
| 12 |
altKey: <input id="kd_altKey"><br/> |
| 13 |
metaKey: <input id="kd_metaKey"><br/> |
| 14 |
<h1>KeyPress.</h1> |
| 15 |
currentTarget: <input id="kp_currentTarget"><br/> |
| 16 |
which: <input id="kp_which"></br> |
| 17 |
shiftKey: <input id="kp_shiftKey"><br/> |
| 18 |
ctrlKey: <input id="kp_ctrlKey"><br/> |
| 19 |
altKey: <input id="kp_altKey"><br/> |
| 20 |
metaKey: <input id="kp_metaKey"><br/> |
| 21 |
<h1>KeyUp.</h1> |
| 22 |
currentTarget: <input id="ku_currentTarget"><br/> |
| 23 |
which: <input id="ku_which"></br> |
| 24 |
shiftKey: <input id="ku_shiftKey"><br/> |
| 25 |
ctrlKey: <input id="ku_ctrlKey"><br/> |
| 26 |
altKey: <input id="ku_altKey"><br/> |
| 27 |
metaKey: <input id="ku_metaKey"><br/> |
| 28 |
<script> |
| 29 |
$(function() { |
| 30 |
function KdDescribeEvent(event){ |
| 31 |
$('#kd_currentTarget').val(event.currentTarget); |
| 32 |
$('#kd_which').val(event.which); |
| 33 |
$('#kd_shiftKey').val(event.shiftKey); |
| 34 |
$('#kd_ctrlKey').val(event.ctrlKey); |
| 35 |
$('#kd_altKey').val(event.altKey); |
| 36 |
$('#kd_metaKey').val(event.metaKey); |
| 37 |
} |
| 38 |
function KpDescribeEvent(event){ |
| 39 |
$('#kp_currentTarget').val(event.currentTarget); |
| 40 |
$('#kp_which').val(event.which); |
| 41 |
$('#kp_shiftKey').val(event.shiftKey); |
| 42 |
$('#kp_ctrlKey').val(event.ctrlKey); |
| 43 |
$('#kp_altKey').val(event.altKey); |
| 44 |
$('#kp_metaKey').val(event.metaKey); |
| 45 |
} |
| 46 |
function KuDescribeEvent(event){ |
| 47 |
$('#ku_currentTarget').val(event.currentTarget); |
| 48 |
$('#ku_which').val(event.which); |
| 49 |
$('#ku_shiftKey').val(event.shiftKey); |
| 50 |
$('#ku_ctrlKey').val(event.ctrlKey); |
| 51 |
$('#ku_altKey').val(event.altKey); |
| 52 |
$('#ku_metaKey').val(event.metaKey); |
| 53 |
} |
| 54 |
|
| 55 |
setTimeout(function() { |
| 56 |
$(document).bind('keydown', KdDescribeEvent); |
| 57 |
$(document).bind('keypress', KpDescribeEvent); |
| 58 |
$(document).bind('keyup', KuDescribeEvent); |
| 59 |
}, 500); |
| 60 |
}); |
| 61 |
|
| 62 |
</script> |
| 63 |
</body> |
| 64 |
</html> |