ondblclick - 双击文本时

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function myFunction() {
  6. document.getElementById("demo").innerHTML = "Hello World";
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <p ondblclick="myFunction()">双击此段以触发函数。</p>
  13.  
  14. <p id="demo"></p>
  15.  
  16. </body>
  17. </html>