例項屬性
繼承自其父級 HTMLElement 的屬性。
HTMLTitleElement.text-
一個表示文件標題文字的字串。
例項方法
無特定方法;從其父級 HTMLElement 繼承方法。
示例
請勿混淆:document.title 與 document.querySelector('title')
前者只是一個 setter/getter 方法,用於設定或獲取文件標題的內部文字值,而後者是 HTMLTitleElement 物件。因此,您不能這樣寫:document.title.text = "Hello world!";
相反,您可以簡單地寫:document.title = "Hello world!";,這等同於 document.querySelector('title').text = "Hello world!";
規範
| 規範 |
|---|
| HTML # htmltitleelement |
瀏覽器相容性
載入中…
另見
- 實現此介面的 HTML 元素:
<title>。