HTML DOM title 属性

定义和用法

title 属性可返回当前文档的标题( HTML title 元素中的文本)。

语法

  1. document.title

实例

  1. <html>
  2. <head>
  3. <title>My title</title>
  4. </head>
  5.  
  6. <body>
  7. The title of the document is:
  8. <script type="text/javascript">
  9. document.write(document.title)
  10. </script>
  11. </body>
  12.  
  13. </html>