Mega Code Archive

 
Categories / JavaScript Tutorial / Document
 

Assign value to the document title (you must have the title tag in your html document)

< html> <head> <title>Untitled</title> <script language="javascript" type="text/javascript"> function changeTitle() {     var newTitle = prompt("A title.", "default title");     window.document.title = newTitle; } </script> </head> <body> <P>You can change <a href="javascript:changeTitle()"> the &lt;title&gt; element</a> on this page</p> </body> </html>