源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <h1 id="myH1"></h1> <p id="myP"></p> <script> // 输出标题: document.getElementById("myH1").innerHTML="Welcome to my Homepage"; // 输出段落: document.getElementById("myP").innerHTML="This is my first paragraph."; </script> <p><b>注释:</b>注释不会被执行。</p> </body> </html>
运行结果