此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

GlobalEventHandlers.onpointerup

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2020年7月⁩.

pointerup 是一个全局的事件处理函数。

语法

var upHandler = targetElement.onpointerup;

返回值

upHandler

返回 targetElement 元素的pointerup事件处理函数。

示例

如下是两种设置元素pointerup事件处理函数的方法。

js
<html>
<script>
function upHandler(ev) {
 // 这里添加元素的 pointup 事件处理函数
}
function init() {
 var el=document.getElementById("target1");
 el.onpointerup = upHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointerup="upHandler(event)"> Touch me ... </div>
</body>
</html>

规范

Specification
Pointer Events
# the-pointerup-event
Pointer Events
# dom-globaleventhandlers-onpointerup

浏览器兼容性

参见