源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <head> <title>编程字典</title> <script> function myFunction() { document.getElementById("demo").innerHTML = "Hello JavaScript!"; } </script> </head> <body> <h1>编程字典</h1> <p id="demo">爱学习,更爱分享!</p> <button type="button" onclick="myFunction()">试试</button> </body> </html>
运行结果