--- title: GlobalEventHandlers.onpointerup slug: Web/API/GlobalEventHandlers/onpointerup translation_of: Web/API/GlobalEventHandlers/onpointerup ---
{{ApiRef("HTML DOM")}}

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

语法

var upHandler = targetElement.onpointerup;

返回值

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

示例

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

<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 Status Comment
{{SpecName('Pointer Events 2','#widl-GlobalEventHandlers-onpointerup', 'onpointerup')}} {{Spec2('Pointer Events 2')}} Non-stable version
{{SpecName('Pointer Events', '#widl-GlobalEventHandlers-onpointerup', 'onpointerup')}} {{Spec2('Pointer Events')}} Initial definition

浏览器兼容性

{{Compat("api.GlobalEventHandlers.onpointerup")}}

相关链接