GlobalEventHandlers.onpointerdown

语法

var downHandler = targetElement.onpointerdown;

返回值

downHandler
pointerdown 事件触发对象的事件处理程序。

示例

当前示例展示两种方式使用 onpointerdown 去设置元素的 pointerdown 事件处理程序。

<html>
<script>
function downHandler(ev) {
 // Process the pointerdown event
}
function init() {
 var el=document.getElementById("target1");
 el.onpointerdown = downHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointerdown="downHandler(event)"> Touch me ... </div>
</body>
</html>

规范

Specification
Pointer Events
# dom-globaleventhandlers-onpointerdown

浏览器支持

BCD tables only load in the browser

 

参阅