iPadでキーボードをbluetooth接続し、そのキーボードから入力した文字を取得したいと考えています。
その際、テキスト入力欄 <input type="text" id="aaa">
にフォーカスがある場合は以下の「onkeydown」イベントにて処理されますが、フォーカスが入力欄以外(ラジオボタンなど)にある場合このイベントが発生しません。
sample.html
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
document.onkeydown = function (e) {
var chr = String.fromCharCode(e.keyCode);
document.getElementById("aaa").value = document.getElementById("aaa").value + chr;
};
// -->
</script>
</head>
<body>
<form name="form1" id="form1">
<input type="text" id="aaa">
<input type="radio" id="bbb" name="ccc">
</form>
</body>
</html>
どうすれば入力欄以外でも入力キーが取得できるのでしょうか?