show-notice
hide-notice

Wednesday, 24 July 2013

How to use Comments JavaScript


Introduction

Comments will not be executed by JavaScript.Comments can be added to explain the JavaScript, or to make the code more readable.Single line comments start with //.
Example
<html>
<body>

<h1 id="myH1"></h1>

<p id="myP"></p>

<script>
// Write to a heading:
document.getElementById("myH1").innerHTML="Welcome to my Homepage";
// 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>


SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com