--- title: GlobalEventHandlers.onpointercancel slug: Web/API/GlobalEventHandlers/onpointercancel translation_of: Web/API/GlobalEventHandlers/onpointercancel ---
A {{domxref("GlobalEventHandlers","global event handler")}} for the {{event("pointercancel")}} event.
var cancelHandler = targetElement.onpointercancel;
cancelHandler
targetElement
的 pointercancel 事件处理器。该示例展示使用 onpointercancel 设置一个元素的 pointercancel 事件处理器的两个方法。
<html> <script> function cancelHandler(ev) { // 处理 pointercancel 事件 } function init() { var el=document.getElementById("target1"); el.onpointercancel = cancelHandler; } </script> <body onload="init();"> <div id="target1"> Touch me ... </div> <div id="target2" onpointercancel="cancelHandler(event)"> Touch me ... </div> </body> </html>
规范 | 状态 | 注释 |
---|---|---|
{{SpecName('Pointer Events 2','#widl-GlobalEventHandlers-onpointercancel', 'onpointercancel')}} | {{Spec2('Pointer Events 2')}} | Non-stable 版本 |
{{SpecName('Pointer Events', '#widl-GlobalEventHandlers-onpointercancel', 'onpointercancel')}} | {{Spec2('Pointer Events')}} | 初始定义 |
{{CompatibilityTable}}
特性 | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
支持基础 | {{CompatChrome(55.0)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatIE("10")}} | {{CompatOpera(42)}} | {{CompatNo}} |
特性 | Android | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|---|
支持基础 | {{CompatNo}} | {{CompatChrome(55.0)}} | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatIE("10")}} | {{CompatOperaMobile(42)}} | {{CompatNo}} | {{CompatChrome(55.0)}} |