DOM

Window:keyup イベント

 編集:2022.10.17 by T.A.

[Edge]。→

ウインドウ内でキーが放されたときに発行されます。シフトキーなどの装飾キーでも発行されます。

バブリング ¶あり
キャンセル可能 ¶はい
インターフェイス KeyboardEvent
イベント ハンドラー プロパティ onkeyup
keyup イベント

HTML:

<SPAN contenteditable>[SPAN要素。ここで編集…]</SPAN><BR>
<INPUT type=text>
<SPAN id=IdLog></SPAN>

JavaScript:

function JobD(eve){  //keydown イベントの処理:
  D=eve;  //=[object]:[object KeyboardEvent]。文書内で空白部で [a]キーを押した。
詳細 //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]:0 //keyCode=[number]:65 //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]:65 //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 //…
IdLog.innerHTML=IdLog.innerHTML+"key:"+eve.key+" "; } function JobU(eve){ //keyup イベントの処理: DA=eve; //=[object]:[object KeyboardEvent]。文書内で空白部で [a]キーを放した。
詳細 //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]:0 //keyCode=[number]:65 //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]:65 //initUIEvent=[function]:function initUIEvent() { [native code] } //type=[string]:keyup //target=[object]:[object HTMLBodyElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…
IdLog.innerHTML=IdLog.innerHTML+"key:"+eve.key+" "; } window.onkeydown=JobD; //イベント割り当て。 window.onkeyup=JobU; //イベント割り当て。

編集可能要素で FEP を介して「あ」の [a]キーを押した。

//D=[object]:[object KeyboardEvent]
詳細//isTrusted=[boolean]:true //key=[string]:Process //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]:0 //keyCode=[number]:229 //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]:229 //initUIEvent=[function]:function initUIEvent() { [native code] } //type=[string]:keydown //target=[object]:[object HTMLSpanElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…

編集可能要素で 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]:true //charCode=[number]:0 //keyCode=[number]:65 //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]:65 //initUIEvent=[function]:function initUIEvent() { [native code] } //type=[string]:keyup //target=[object]:[object HTMLSpanElement] //currentTarget=[object]:null //eventPhase=[number]:0 //bubbles=[boolean]:true //cancelable=[boolean]:true //defaultPrevented=[boolean]:false //composed=[boolean]:true //…

変換中になるために isComposing は true になる。


テスト