Or the contentEditable area:
Html程序  |  28行  |  862 B

<html>
<body>
<p>Typing in the input fields below should not generate text, even with an IME enabled.</p>

Type into the input:
<input type=text id='input'></input><br>
<div id='out' style="float: right"></div>
Or the text area:
<textarea id='area'></textarea><br>
Or the contentEditable area:
<div contentEditable id='ce' style="border:1px solid red; height:300px; width:300px;"></div>
<script>
var input = document.getElementById('input');
var area = document.getElementById('area');
var ce = document.getElementById('ce');

var handleKeyDown = function(e) {
  document.getElementById('out').innerHTML += "<br>Got a key event -- cancelling";
  e.preventDefault();
}

input.addEventListener('keydown', handleKeyDown, false);
area.addEventListener('keydown', handleKeyDown, false);
ce.addEventListener('keydown', handleKeyDown, false);
</script>
</body>
</html>