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