Javascript examples for DOM:Element nodeName
Element nodeName Property - Get the node type of the <body> element:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w ww . j a v a 2s . c o m var x = document.body.nodeType; document.getElementById("demo").innerHTML = x; } </script> </body> </html>