GlobalEventHandlers.onpointercancel
A global event handler
for the pointercancel
event.
语法
var cancelHandler = targetElement.onpointercancel;
返回值
cancelHandler
-
元素
targetElement
的 pointercancel 事件处理器。
示例
该示例展示使用 onpointercancel 设置一个元素的 pointercancel 事件处理器的两个方法。
js
<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>
规范
Specification |
---|
Pointer Events # the-pointercancel-event |
Pointer Events # dom-globaleventhandlers-onpointercancel |
浏览器兼容性
BCD tables only load in the browser