GlobalEventHandlers.ondblclick
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
ondblclick
property는 현재 요소(element)의 onDblClick 이벤트 핸들러 코드를 돌려줍니다.
구문
js
element.ondblclick = function;
function
은 사용자 정의 함수이며, () 나 변수를 제외하고 생성할 수 있고 또는 아래와 같이 함수명을 선언하지 않고 생성할 수 있습니다.
js
element.ondblclick = function () {
console.log("ondblclick event detected!");
};
예제
다음 예제는 더블클릭의 위치를 기록합니다.
HTML
html
<p>Double click anywhere in this example.</p>
<p id="log"></p>
JavaScript
js
let log = document.getElementById("log");
document.ondblclick = logDoubleClick;
function logDoubleClick(e) {
log.textContent = `Position: (${e.clientX}, ${e.clientY})`;
}
결과
명세
Specification |
---|
UI Events # event-type-dblclick |
HTML # handler-ondblclick |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
dblclick event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- See implementation notes.
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.