[Edge]。→、、
ウインドウ内でキーが押されたときに発行されます。シフト キーなどの装飾キーは発行されません。FEP などで変換入力では発行されません。
バブリング | ¶あり |
---|---|
キャンセル可能 | ¶はい |
インターフェイス | ¶KeyboardEvent |
イベント ハンドラー プロパティ | onkeypress |
HTML:
<SPAN contenteditable>[SPAN要素。ここで編集…]</SPAN><BR> <INPUT type=text>
<SPAN id=IdLog></SPAN>
JavaScript:
function Job(eve){ //keypress イベントの処理: D=eve; //=[object]:[object KeyboardEvent]。当文書の空白部分をクリックしてから [a]キーを押した。IdLog.innerHTML=IdLog.innerHTML+"key:"+eve.key+" "; } window.onkeypress=Job; //イベント割り当て。詳細
//isTrusted=[boolean]:true //key=[string]:a //code=[string]:KeyA //location=[number]:0 //ctrlKey=[boolean]:false //shiftKey=[boolean]:false //altKey=[boolean]:false //metaKey=[boolean]:false //repeat=[boolean]:false //isComposing=[boolean]:false //charCode=[number]:97 //keyCode=[number]:97 //DOM_KEY_LOCATION_STANDARD=[number]:0 //DOM_KEY_LOCATION_LEFT=[number]:1 //DOM_KEY_LOCATION_RIGHT=[number]:2 //DOM_KEY_LOCATION_NUMPAD=[number]:3 //getModifierState=[function]:function getModifierState() { [native code] } //initKeyboardEvent=[function]:function initKeyboardEvent() { [native code] } //view=[object]:[object Window] //detail=[number]:0 //sourceCapabilities=[object]:[object InputDeviceCapabilities] //which=[number]:97 //initUIEvent=[function]:function initUIEvent() { [native code] } //type=[string]:keypress //target=[object]:[object HTMLBodyElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…