键盘事件 KeyboardEvent()

KeyboardEvent() 构造函数新建一个 KeyboardEvent 实例。

语法

 event = new KeyboardEvent(typeArg, KeyboardEventInit);

typeArg

DOMString 类型,表示事件名称。

KeyboardEventInit可选

KeyboardEventInit 字典,有以下几种值:

备注: KeyboardEventInit 字典也可以接受来自 UIEventInitEventInit 的字典字段值。

规范

Specification
UI Events
# dom-keyboardevent-keyboardevent

浏览器兼容性

BCD tables only load in the browser

参考