JavaScript和C语言一样使用 // 作为单行注释的标签
<!DOCTYPE html> <html> <body> <h1 id="myH1"></h1> <p id="myP"></p> <script> // Write to a heading: document.getElementById("myH1").innerHTML="Welcome to 75271.com"; // Write to a paragraph: document.getElementById("myP").innerHTML="This is my first paragraph."; </script> <p><strong>Note:</strong> The comments are not executed.</p> </body> </html>