MouseEvent: getModifierState() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

MouseEvent.getModifierState() メソッドは、指定された修飾キーの現在の状態を返します。修飾キーが有効(すなわち、修飾キーが押されているかロックされている)ならば true、そうでなければ false を返します。

詳しくは KeyboardEvent.getModifierState() を参照してください。

構文

js
getModifierState(key)

引数

key

修飾キーの値です。 値は修飾キーを表す KeyboardEvent.key 値のいずれか、または "Accel" 非推奨; である必要があります。 これは大文字と小文字を区別します。

返値

論理値です。

仕様書

Specification
UI Events
# dom-mouseevent-getmodifierstate

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getModifierState
"Accel" parameter
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.

関連情報