Example When the mouse button is double-clicked, a section of JavaScript is executed: Copy TextCopy after loginBrowser support IEFirefoxChromeSafariOpera All major browsers support the ondblclick attribute. Definition and usageondblclick attribute is triggered when the mouse double-clicks the element. Note: The ondblclick attribute does not apply to the following elements: , , , , , , , , , <style> or <title>. </a></p>Differences between HTML 4.01 and HTML5<p style="margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑; white-space: normal; background-color: rgb(253, 252, 248);"></p>None. <p></p>Syntax<p style="margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑; white-space: normal; background-color: rgb(253, 252, 248);"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><element ondblclick="script"></pre><div class="contentsignin">Copy after login</div></div></p>Attribute value<p style="margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 16px; color: rgb(0, 0, 0); font-family: PingFangSC-Regular, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);"></p><table><tbody><tr class="firstRow">Value<td width="112" valign="top" style="word-break: break-all;"></td>Description<td width="997" valign="top" style="word-break: break-all;"></td></tr><tr>script<td width="112" valign="top" style="word-break: break-all;"></td>Script that runs when ondblclick occurs. <td width="997" valign="top" style="word-break: break-all;"></td></tr></tbody></table>In a recent project, I encountered the need to add <p>onclick<a href="//m.sbmmt.com/wiki/1449.html" target="_blank"> and ondblclick two </a>events<a href="//m.sbmmt.com/js/js-jspopular-guide-event.html" target="_blank"> on the same DOM element. If you follow the normal Method to add processing, it turns out that only onclick will be executed, </a></p> but not ondblclick; at this time, we need to slightly process the processing functions of the two events to achieve the coexistence of the two events. The code is as follows: <p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><script type="text/javascript"> var clickTimer = null; function _click(){ if(clickTimer) { window.clearTimeout(clickTimer); clickTimer = null; } clickTimer = window.setTimeout(function(){ // your click process code here alert("你单击了我"); }, 300); } function _dblclick(){ if(clickTimer) { window.clearTimeout(clickTimer); clickTimer = null; } // your click process code here alert("你双击了我"); } 单击或双击我Copy after login