源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <h2>write() 方法</h2> <h2>向页面写入内容</h2> <p>如果页面已载入,将覆盖整个 HTML 文档。</p> <button type="button" onclick="myFunction()">点我</button> <script> function myFunction() { document.write("Hello World"); } </script> </body> </html>
运行结果: