Javascript examples for DOM HTML Element:HTML
The HTML object represents an HTML <html> element.
You can access the <html> element by using getElementsByTagName():
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">get the HTML content of the html element</button> <p id="demo"></p> <script> function myFunction() {//from w ww.j a va 2s . co m var x = document.getElementsByTagName("HTML")[0].innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>