1//<p>Click the button to get the tag names of the body element's children.</p>
2
3//<button onclick="myFunction()">Try it</button>
4
5//<p id="demo"></p>
6
7<!-- <script> -->
8function myFunction() {
9 var c = document.body.children;
10 var txt = "";
11 var i;
12 for (i = 0; i < c.length; i++) {
13 txt = txt + c[i].tagName + "<br>";
14 }
15
16 document.getElementById("demo").innerHTML = txt;
17}
18<!-- </script> -->