diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/globaleventhandlers/ondblclick | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/globaleventhandlers/ondblclick')
-rw-r--r-- | files/zh-cn/web/api/globaleventhandlers/ondblclick/index.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/globaleventhandlers/ondblclick/index.html b/files/zh-cn/web/api/globaleventhandlers/ondblclick/index.html new file mode 100644 index 0000000000..9fa956b1c2 --- /dev/null +++ b/files/zh-cn/web/api/globaleventhandlers/ondblclick/index.html @@ -0,0 +1,71 @@ +--- +title: GlobalEventHandlers.ondblclick +slug: Web/API/GlobalEventHandlers/ondblclick +translation_of: Web/API/GlobalEventHandlers/ondblclick +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<h3 id="概述">概述</h3> + +<p><strong>ondblclick</strong>属性用来获取或设置当前元素的<code>dblclick</code>事件的事件处理函数.</p> + +<h3 id="语法">语法</h3> + +<pre class="eval">element.ondblclick = function; +</pre> + +<ul> + <li><code>function</code> 是一个函数名,后面没有括号(),或者是一个匿名的函数表达式,比如</li> +</ul> + +<pre class="eval">element.ondblclick = function() { alert("触发了dblclick事件!"); }; +</pre> + +<h3 id="例子">例子</h3> + +<pre class="brush: html"><html> + +<head> +<title>ondblclick示例演示</title> + +<script type="text/javascript"> + +function initElement() + { + var p = document.getElementById("foo"); + // 注意:这里写成showAlert()或者 showAlert(参数)是不对的. + // 必须是一个函数名,而不是函数调用. + p.ondblclick = showAlert; + }; + +function showAlert() + { + alert("检测到dblclick事件!") + } +</script> + +<style type="text/css"> +<!-- +#foo { +border: solid blue 2px; +} +--> +</style> +</head> + +<body onload="initElement()";> +<span id="foo">这是一个元素</span> +<p>双击上面的元素会触发dblclick事件.</p> +</body> +</html> +</pre> + +<h3 id="备注">备注</h3> + +<p>在当前元素上双击鼠标左键会触发<code>dblclick</code>事件.</p> + +<h3 id="规范">规范</h3> + +<p>不属于任何公开的规范.</p> + +<p>{{ languages( { "fr": "fr/DOM/element.ondblclick","zh-cn": "zh-cn/DOM/element.ondblclick" } ) }}</p> |