UIEvent 接口表示简单用户界面事件。

UIEvent 派生自 事件 。尽管 UIEvent.initUIEvent() method is kept for backward compatibility, you should create a UIEvent 对象使用 UIEvent() 构造函数。

Several interfaces are direct or indirect descendants of this one: MouseEvent , TouchEvent , FocusEvent , KeyboardEvent , WheelEvent , InputEvent ,和 CompositionEvent .

  <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="../API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text  x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25  86,20  86,30  76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="../API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text  x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">UIEvent</text></a></svg></div>
					
  a:hover text { fill: #0095DD; pointer-events: all;}
					

构造函数

UIEvent()
创建 UIEvent 对象。

特性

此接口还继承其父级的特性, 事件 .

UIEvent.cancelBubble
布尔 indicating whether the bubbling of the event has been canceled or not.
UIEvent.detail 只读
返回 long with details about the event, depending on the event type.
UIEvent.isChar 只读
返回 布尔 indicating whether the event produced a key character or not.
UIEvent.layerX 只读

Returns the horizontal coordinate of the event relative to the current layer.

UIEvent.layerY 只读

Returns the vertical coordinate of the event relative to the current layer.

UIEvent.pageX 只读

Returns the horizontal coordinate of the event relative to the whole document.

UIEvent.pageY 只读

Returns the vertical coordinate of the event relative to the whole document.

UIEvent.sourceCapabilities 只读
Returns an instance of the InputDeviceCapabilities interface, which provides information about the physical device responsible for generating a touch event.
UIEvent.view 只读
返回 WindowProxy that contains the view that generated the event.
UIEvent.which 只读
Returns the numeric keyCode of the key pressed, or the character code ( charCode ) for an alphanumeric key pressed.

方法

此接口还继承其父级的方法, 事件 .

UIEvent.initUIEvent()
初始化 UIEvent object. If the event has already being dispatched, this method does nothing.

规范

规范 状态 注释
InputDeviceCapabilities 草案 添加 sourceCapabilities 特性。
UI Events 工作草案 扩展 DOM3
DOM (文档对象模型) 3 级事件规范
在该规范中的 UIEvent 定义。
过时 添加 UIEvent() constructor, deprecated the initUIEvent() method and changed the type of view from AbstractView to WindowProxy .
DOM (文档对象模型) 2 级事件规范
在该规范中的 UIEvent 定义。
过时 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
UIEvent Chrome Yes Edge 12 Firefox Yes IE Yes Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
UIEvent() 构造函数 Chrome Yes Edge ≤18 Firefox 11 IE ? Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android 14 Opera Android Yes Safari iOS ? Samsung Internet Android Yes
cancelBubble 弃用 非标 Chrome Yes Edge 12 Firefox Yes IE Yes Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
detail Chrome Yes Edge 12 Firefox Yes IE 部分支持 9
部分支持 9
Always 0 on click and dblclick events. On mousedown and mouseup events, the count is not unique to the element, but is rather the global click count for the current document -- even across refreshes.
Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
initUIEvent 弃用 非标 Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android Yes
isChar 弃用 非标 Chrome No Edge No Firefox ? — 55
不支持 ? — 55
isChar property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.
IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android ? — 55
不支持 ? — 55
isChar property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.
Opera Android No Safari iOS No Samsung Internet Android No
layerX 非标 Chrome Yes Edge 12 Firefox Yes IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
layerY 非标 Chrome Yes Edge 12 Firefox Yes IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
pageX 弃用 非标 Chrome ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageX in version 45.
Edge 12 Firefox ? IE 9 Opera ? Safari ? WebView Android ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageX in version 45.
Chrome Android ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageX in version 45.
Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ? — 4.0
不支持 ? — 4.0
Replaced by MouseEvent.pageX in Samsung Internet 5.0.
pageY 弃用 非标 Chrome ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageY in version 45.
Edge 12 Firefox ? IE 9 Opera ? Safari ? WebView Android ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageY in version 45.
Chrome Android ? — 44
不支持 ? — 44
Replaced by MouseEvent.pageY in version 45.
Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ? — 4.0
不支持 ? — 4.0
Replaced by MouseEvent.pageY in Samsung Internet 5.0.
sourceCapabilities Chrome 47 Edge ≤79 Firefox ? IE ? Opera Yes Safari ? WebView Android 47 Chrome Android 47 Firefox Android ? Opera Android Yes Safari iOS ? Samsung Internet Android 5.0
view Chrome Yes Edge 12 Firefox Yes IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
which Chrome Yes Edge ≤79 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持

完整支持

部分支持

部分支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. UIEvent
  2. 构造函数
    1. UIEvent()
  3. 特性
    1. cancelBubble
    2. detail
    3. isChar
    4. layerX
    5. layerY
    6. pageX
    7. pageY
    8. sourceCapabilities
    9. view
  4. 方法
    1. initUIEvent
  5. 事件
    1. initUIEvent
  6. 继承:
    1. 事件
  7. DOM 事件相关页面
    1. CompositionEvent
    2. 事件
    3. EventListener
    4. EventTarget
    5. FocusEvent
    6. InputEvent
    7. KeyboardEvent
    8. MouseEvent
    9. MouseScrollEvent
    10. MouseWheelEvent
    11. MutationEvent
    12. ProgressEvent
    13. WheelEvent

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1