Home  >  Article  >  Web Front-end  >  How to use document.title in JavaScript?

How to use document.title in JavaScript?

PHPz
PHPzforward
2023-08-28 14:57:09703browse

How to use document.title in JavaScript?

Use the document.title property to set the title of the document in JavaScript.

Example

You can try running the following code to implement the document.title property in JavaScript.

Real-time demonstration

<!DOCTYPE html>
<html>
   <head>
      <title>Demo Title</title>
   </head>
   <body>
      <script>
         var x = document.title;
         document.write("Our Title: "+x);
      </script>
   </body>
</html>

The above is the detailed content of How to use document.title in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete