GlobalEventHandlers.onpointerdown
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.
pointerdown
事件的 全局事件处理程序
语法
var downHandler = targetElement.onpointerdown;
返回值
downHandler
-
pointerdown 事件触发对象的事件处理程序。
示例
当前示例展示两种方式使用 onpointerdown 去设置元素的 pointerdown 事件处理程序。
js
<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 # the-pointerdown-event |
Pointer Events # dom-globaleventhandlers-onpointerdown |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pointerdown event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.