[Edge]。→、
文書上で、キー入力で、文字値を生成する(確定している)キーが押下されたときに発行されます。¶シフト キーなどは関知されません。FEP など利用で変換入力は関知されず。
バブリング | ¶あり |
---|---|
キャンセル | ¶可能 |
インターフェイス | ¶KeyboardEvent |
イベント ハンドラー プロパティ | onkeypress |
HTML:
<SPAN id=IdLog></SPAN>
JavaScript:
function Job(eve){ //keypressイベントの処理: D=eve; //=[object]:[object KeyboardEvent]。TEXTAREA要素内で「a」とタイピングした。IdLog.innerHTML="code:"+ eve.code +"、key:"+ eve.key; } document.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 HTMLTextAreaElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…
TEXTAREA要素内でFEPを介して「あ」とタイピングしても反応は無い。
編集不可能要素をクリックしておいて、[a]とタイピングした:
//D=[object]:[object KeyboardEvent]詳細
//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 //…
編集不可能要素をクリックしておいて、[←]キー入力した:
//D=[object]:[object KeyboardEvent]詳細
//isTrusted=[boolean]:true //key=[string]:ArrowLeft //code=[string]:ArrowLeft //location=[number]:0 //ctrlKey=[boolean]:false //shiftKey=[boolean]:false //altKey=[boolean]:false //metaKey=[boolean]:false //repeat=[boolean]:false //isComposing=[boolean]:false //charCode=[number]:0 //keyCode=[number]:37 //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]:37 //initUIEvent=[function]:function initUIEvent() { [native code] } //type=[string]:keydown //target=[object]:[object HTMLBodyElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…