Dynamically Change the Title of an HTML Page



Here is a simple way by which you can dynamically change the title of the browser window (or an HTML page). There are certain scenarios where you can use this feature to provide useful information to the user. 
<HTML>
<HEAD><TITLE>Change Title Dynamically:</TITLE></HEAD>
<BODY>
<FORM action="" method=POST name="dynamicForm">
<B>Enter Title for the window:</B>
<input type="text" name="headerTitle">
<INPUT TYPE=BUTTON VALUE="Change Title" onclick="javascript:updateTitle()">
</FORM>
<SCRIPT LANGUAGE="JAVASCRIPT">
function updateTitle()
{
 document.title = document.dynamicForm.headerTitle.value;
}
</SCRIPT>
</BODY>
</HTML>

  



Previous
Next Post »