<html>
<body>
<p>在输入字段中按键盘上的 "O" 键来提示一些文本。</p>
<input type="text" size="40" onkeypress="myFunction(event)">
<p id="demo"></p>
<script>
function myFunction(event) {
var x = event.charCode || event.keyCode;
if (x == 111 || x == 79) { // o is 111, O is 79
alert("You pressed the 'O' key!");
}
}
</script>
</body>
</html>