aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/globaleventhandlers/ondblclick
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/globaleventhandlers/ondblclick
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-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.html71
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">&lt;html&gt;
+
+&lt;head&gt;
+&lt;title&gt;ondblclick示例演示&lt;/title&gt;
+
+&lt;script type="text/javascript"&gt;
+
+function initElement()
+ {
+ var p = document.getElementById("foo");
+ // 注意:这里写成showAlert()或者 showAlert(参数)是不对的.
+ // 必须是一个函数名,而不是函数调用.
+ p.ondblclick = showAlert;
+ };
+
+function showAlert()
+ {
+ alert("检测到dblclick事件!")
+ }
+&lt;/script&gt;
+
+&lt;style type="text/css"&gt;
+&lt;!--
+#foo {
+border: solid blue 2px;
+}
+--&gt;
+&lt;/style&gt;
+&lt;/head&gt;
+
+&lt;body onload="initElement()";&gt;
+&lt;span id="foo"&gt;这是一个元素&lt;/span&gt;
+&lt;p&gt;双击上面的元素会触发dblclick事件.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</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>