Use the DOM to find and display the document's title. - Javascript DOM

Javascript examples for DOM:Quiz

Description

Use the DOM to find and display the document's title.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
  <head>
  <title>W3Schools Demo</title>
  </head>/*ww  w . j ava  2  s.  c o m*/
<body>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"The title of this document is: " + document.title;
</script>

</body>
</html>

Related Tutorials