Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <body> <p>该实例声明一个函数,函数调用时在 id="demo" 的元素上输出 "Hello World" 。</p> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = "Hello World!"; } myFunction(); </script> </body> </html>