spacer
Yehuda Shiran January 21, 2000
The title Property
Tips: January 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
The document's title is set by default to its complete URL. Most Web page authors replace this title with their own text, specified in the <TITLE></TITLE> tag pair in the Head portion. When the Web page includes frames, the title bar displays the title of the document which contains the frameset. Documents providing the content of the frames may include their own titles, but they don't affect the title bar.

The document's title can be scripted via JavaScript as well. Its general reference is document.title. This property cannot be set by just any JavaScript script, but only during construction of the whole document. You can use the title property in may different ways. Suppose you want your document to have a large header containing the document's title. Here is such a page's outline:

<HTML>
<HEAD>
<TITLE>Tomer Shiran's Home Page</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write("<CENTER><H1>" + document.title + "</H1></CENTER>");

// -->
</SCRIPT>
</BODY>
</HTML>

If you do not include the <TITLE></TITLE> tag pair, the title defaults to the complete URL of the document, including any search query, if one is specified. If you place the <TITLE></TITLE> tag pair without text in between, the title still defaults to URL. If the text between the opening and closing tags does not include any characters but one or more space characters, the document is assumed untitled, and document.title remains an empty string, or a space-filled string in the case of the Explorer. The property document.title never evaluates to the URL, unless you specifically write the URL between the <TITLE></TITLE> tags.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags