源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <p id="p1">Hello world!</p> <script> function ChangeText() { document.getElementById("p1").innerHTML="Hello Runoob!"; } </script> <input type="button" onclick="ChangeText()" value="修改文本" /> </body> </html>
运行结果