57 lines
1.3 KiB
HTML
57 lines
1.3 KiB
HTML
|
<!--
|
||
|
Copyright 2004 ThoughtWorks, Inc
|
||
|
|
||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
you may not use this file except in compliance with the License.
|
||
|
You may obtain a copy of the License at
|
||
|
|
||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
Unless required by applicable law or agreed to in writing, software
|
||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
See the License for the specific language governing permissions and
|
||
|
limitations under the License.
|
||
|
-->
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Special Keys Page</title>
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
window.onload = function() {
|
||
|
var input = document.getElementById('input'),
|
||
|
check = document.getElementById('check');
|
||
|
|
||
|
input.addEventListener('keydown', function(e) {
|
||
|
result = e.keyCode;
|
||
|
|
||
|
if (e.altKey) {
|
||
|
result += ',alt';
|
||
|
}
|
||
|
|
||
|
if (e.ctrlKey) {
|
||
|
result += ',control';
|
||
|
}
|
||
|
|
||
|
if (e.shiftKey) {
|
||
|
result += ',shift';
|
||
|
}
|
||
|
|
||
|
// only alert if the key isn't Alt, Control or Shift
|
||
|
if ([16, 17, 18].indexOf(e.which) == -1) {
|
||
|
check.innerHTML = result;
|
||
|
}
|
||
|
|
||
|
return false;
|
||
|
});
|
||
|
};
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<input id="input" />
|
||
|
<div id="check" />
|
||
|
</body>
|
||
|
|
||
|
</html>
|