GlobalEventHandlers.onpointerout
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
一个global event handler
用于处理 pointerout
事件。
语法
在类似 addEventListener()
这样的方法中使用事件名称,或设置事件处理器属性。
js
addEventListener("pointerout", (event) => {});
onpointerout = (event) => {};
返回值
outHandler
-
元素
targetElement
的指针输出事件处理程序。
示例
这个例子展示了两种方式来使用 onpointerout 设置元素的 pointerout 事件处理程序。
js
<html>
<script>
function outHandler(ev) {
// Process the pointerout event
}
function init() {
var el=document.getElementById("target1");
el.onpointerout = outHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointerout="outHandler(event)"> Touch me ... </div>
</body>
</html>
规范
Specification |
---|
Pointer Events # the-pointerout-event |
Pointer Events # dom-globaleventhandlers-onpointerout |
浏览器兼容性
BCD tables only load in the browser