If you're new here, you may want to subscribe to my RSS feed. So that you can read the latest updates about Web2.0 tools, Making Money Online, Tips in SEO, Ajax and many more. Thanks for visiting ProgramimiCOM!
JavaScript has a handy, and fun, little thing called document.title, all it does is change the title, but it’s handy in certain situations. One of these situations is when dealing with AJAX, I was fetching a post, but the title remained the same.
I quickly learned about document.title, and all my troubles were gone.
All it takes is:
document.title = document.titleform.newtitle.value;
That would work if I had a form named titleform with a field called newtitle. To best implement this, it should be stored in a function, let’s say change():
function change(title)
{
document.title = title;
}
This code will change the title to whatever we want. *evil* I want it to update every keystroke, so we’re going to use the method onkeyup:
<form>
New Title: <input type=‘text’ onkeyup=‘change(this.value);’ />
</form>
Yea, I know, it’s really that simple.
This is a special keyword, it means what you think, this! So it means this value, which is our new title. Heh, now, go off and entertain yourself with this. ![]()
Print This Post
Email This Post
Comments RSS
TrackBack Identifier URI
You must be logged in to post a comment.