源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> </head> <body> <button ondblclick="myFunction()">双击我</button> <p id="demo"></p> <p>当按钮双击时,触发函数,函数在id="demo"的地方输出一些文本</p> <script> function myFunction() { document.getElementById("demo").innerHTML = "编程字典"; } </script> </body> </html>
运行结果