Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

The ondblclick property returns the onDblClick event handler code on the current element.

Syntax

element.ondblclick = function;
  • function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as
element.ondblclick = function() { console.log("ondblclick event detected!"); };

Example

<html>

<head>
<title>ondblclick event example</title>

<script type="text/javascript">

function initElement()
{
  var p = document.getElementById("foo");
  // NOTE: log(); or log(param); will NOT work here.
  // Must be a reference to a function name, not a function call.
  p.ondblclick = log;
};

function log()
{
  console.log("ondblclick Event detected!")
}
</script>

<style type="text/css">
<!--
#foo {
  border: solid blue 2px;
}
-->
</style>
</head>

<body onload="initElement()">
<span id="foo">My Event Element</span>
<p>double-click on the above element.</p>
</body>
</html>

Notes

The dblclick event is raised when the user double clicks an element.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'ondblclick' in that specification.
Living Standard  

ドキュメントのタグと貢献者

 最終更新者: cvrebert,