View Full Version : Change and reset page title

07-15-2011, 03:35 PM
One my website its one index page, putting in content depending on the link (ie ?page=xxxxx) and from that it generats the page name, (Page name - MySite). I also have an AJAX search form working on keyup (kinda like google autosearch). I want it so when i start typing there it changes the title to Search - MySite. Then when its empty revert to what ever it was before. Could someone gimmie a hand doing this? I already have the AJAX coding for the search bar so i can post that if iy would help more.

EDIT: Also i need to check if its on the homepage or not, and if not load the homepage (currently done by php include), does javascript have an equivelant of php's include?

07-15-2011, 03:44 PM
You may do something like

var current=document.title;
document.title = "new title";