Program to Print Hello World
Hii Friends lets see how to print Hello World using JavaScript
Program :
<html>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World";
</script>
</body>
</html>
Explanation :
<script> is used for defining JavaScript , To select an HTML element we are using id . First we need to define that ID in HTML and that ID is used in this Script . This Java Script gives Hello World to the inner HTML which id is demo .
Try it :
http://vitaminjs.kittu.xyz/p/hello-world.html
This Same Code is Written into this Page , Opening this Page Executes the JS and gives us the output ..
Key~ttu
FB Page : https://www.facebook.com/Key_ttu-129975034339888/
Program :
<html>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World";
</script>
</body>
</html>
Explanation :
<script> is used for defining JavaScript , To select an HTML element we are using id . First we need to define that ID in HTML and that ID is used in this Script . This Java Script gives Hello World to the inner HTML which id is demo .
Try it :
http://vitaminjs.kittu.xyz/p/hello-world.html
This Same Code is Written into this Page , Opening this Page Executes the JS and gives us the output ..
Key~ttu
FB Page : https://www.facebook.com/Key_ttu-129975034339888/
Comments
Post a Comment