--- title: KeyboardEvent.repeat slug: Web/API/KeyboardEvent/repeat tags: - KeyboardEvent translation_of: Web/API/KeyboardEvent/repeat ---

{{APIRef("DOM Events")}}

KeyboardEvent.repeat是一个只读属性,返回一个布尔值{{jsxref("Boolean")}},如果按键被一直按住,返回值为true

语法

var repeat = event.repeat;

规范

Specification Status Comment
{{SpecName('DOM3 Events', '#widl-KeyboardEvent-repeat', 'KeyboardEvent.repeat')}} {{Spec2('DOM3 Events')}} Initial definition.

兼容性

{{ CompatibilityTable() }}

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatUnknown() }} {{CompatVersionUnknown}} {{ CompatGeckoDesktop(28) }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{CompatVersionUnknown}} {{ CompatGeckoMobile(28) }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}