--- title: GlobalEventHandlers.ontouchcancel slug: Web/API/GlobalEventHandlers/ontouchcancel translation_of: Web/API/GlobalEventHandlers/ontouchcancel ---
A {{domxref("GlobalEventHandlers","global event handler")}} for the {{event("touchcancel")}} event.
{{SeeCompatTable}}
Note: 这个属性没有被正式标准化。它在 {{SpecName('Touch Events 2')}} 被指定,{{Spec2('Touch Events 2')}} 规范 并且没有在 {{SpecName('Touch Events')}} {{Spec2('Touch Events')}}。此属性没有被广泛实现。
var cancelHandler = someElement.ontouchcancel;
cancelHandler
元素someElement上的
touchcancel事件句柄。这个例子展示了两种方法在元素touchcancel事件句柄上使用ontouchcancel 事件
<html> <script> function cancelTouch(ev) { // 事件执行过程 } function init() { var el=document.getElementById("target1"); el.ontouchcancel = cancelTouch; } </script> <body onload="init();"> <div id="target1"> Touch me ... </div> <div id="target2" ontouchcancel="cancelTouch(event)"> Touch me ... </div> </body> </html>
Specification | Status | Comment |
---|---|---|
{{SpecName('Touch Events 2','#widl-GlobalEventHandlers-ontouchcancel')}} | {{Spec2('Touch Events 2')}} | Non-stable version. |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support |
Feature | Android | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support |