<html>
<body>
<p>在输入字段中按键盘上的 Escape/Esc 键(通常在左上角),可提示一些文本。</p>
<input type="text" size="50" onkeydown="myFunction(event)">
<script>
function myFunction(event) {
var x = event.which || event.keyCode;
if (x == 27) {
alert ("You pressed the Escape key!");
}
}
</script>
</body>
</html>