GlobalEventHandlers.onpointerenter
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.
HTML DOMpointerenter 事件的 GlobalEventHandlers(全局事件处理函数)
js
var enterHandler = targetElement.onpointerenter;
返回值
enterHandler
-
targetElement
的 pointerenter 事件处理函数。
示例
这个例子展示了使用 onpointerenter 来设置元素 pointerenter 事件处理函数的两种方式*。*
js
<html>
<script>
function enterHandler(ev) {
// 处理 pointerenter 事件
}
function init() {
var el=document.getElementById("target1");
el.onpointerenter = enterHandler;
}
</script>
<body onload="init();">
<div id="target1"> 点我 ... </div>
<div id="target2" onpointerenter="enterHandler(event)"> 点我 ... </div>
</body>
</html>
规范
Specification |
---|
Pointer Events # the-pointerenter-event |
Pointer Events # dom-globaleventhandlers-onpointerenter |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pointerenter 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.