document.title

JavaScript 1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

document.title

Description

The title property is a read-only string that specifies the title of the document. This property is commonly set with the <title> tag.

Example

In Listing 7.196, the title of the Web page is written to the screen using the title property.

Listing 7.196 Accessing the title Property of a Document
<html>
<head><title>My Web Page</title></head>

<script>
<!-- Hide

//Output the title of the document
document.write("The title of this page is <i>");
document.write(document.title,"</i>");

//Hide End --->
</script>

</html>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.