W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>本例使用 HTML DOM 将 "ondblclick" 事件分配给 p 元素。</p> <p id="demo">双击我</p> <script> document.getElementById("demo").ondblclick = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = "I was double-clicked!"; } </script> </body> </html>