ondblclick event
ondblclick Event
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> function myFunction(){ document.getElementById("demo").innerHTML="Hello World"; } </script> </head> <body> <p ondblclick="myFunction()">双击这段触发一个函数</p> <p id="demo"></p> </body> </html>
Run instance»
Click "Run instance" button to view the online instance
Definition and usage
ondblclick event occurs when the object is double-clicked.
Syntax
HTML:
<elementondblclick="SomeJavaScriptCode">
In JavaScript:
object.ondblclick=function(){SomeJavaScriptCode};
Parameters | Description |
---|---|
SomeJavaScriptCode | Required. Specifies the JavaScript to be executed when this event occurs. |
Browser Support
##All major browsers support the ondblclick event
HTML tags that support this event: ondblclick attribute can be used with HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.